简体   繁体   中英

Whenever I click on search button without typing anything on search field it takes me too home page of Duck Duck Go, How can I disable that?

I have created a search box which search through Duck Duck Go, It's perfectly working but the problem is that when I click on search button without typing anything on text field it takes user to duck duck go search home page which I don't want here. Can someone help me to solve the problem so that whenevr i click on search button without typing anything the page remains the same Here is the code:

 <form class="form-search" method="get" action="https://duckduckgo.com/"> <input type="search" name="q" placeholder="Search or type web address"> <button type="submit">Search</button> </form>

You can add tag in input field.It will check that while submitting it should have some data in it.的标签。它会检查在提交时是否应该包含一些数据。

 <form class="form-search" method="get" action="https://duckduckgo.com/"> <input type="search" name="q" placeholder="Search or type web address" required> <button type="submit">Search</button> </form>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM