How do I add a “search” button in a text input field?

前端 未结 7 1404
梦毁少年i
梦毁少年i 2020-11-27 18:49

How do I create a similar “search” element to the one in this site?

\"enter

If

7条回答
  •  清酒与你
    2020-11-27 19:43

    If you use a background image on the field then there's no way to bind to it to get the click action. So the solution is to have a separate search field and image, so you can bind click event in jQuery to the image. Fiddle here:

    http://jsfiddle.net/Lzm1k4r8/23/

    You can adjust left: position to be left or right side of the search box.

提交回复
热议问题