clear search button

clear search button

pbercepberce Posts: 15Questions: 2Answers: 0
edited May 2013 in General
just thought I'd post a solution I came up with for adding a clear search button to the search box:

http://live.datatables.net/equwes

In this example I've put a border around the clickable element that goes over the background X image so you can see where it is. The trick is getting it to line up with the X image, everything else I've culled together from this site.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    That's excellent - thank you for sharing with us. The other way is to set the input element's type to be `search` - then HTML5 browsers will add the clear button natively. DataTables 1.10 will likely do this automatically (its already committed actually, I'm just slightly concerned about the lack of styling control).

    Allan
  • geekisheregeekishere Posts: 5Questions: 0Answers: 0
    Hey, I am getting an error while using this plugin to clear the search box.

    "Uncaught TypeError: Cannot read property 'oPreviousSearch' of null " at the line oSettings.oPreviousSearch.sSearch = "";

    Could you tell me what might be wrong?
This discussion has been closed.