jquery selector statement for search box

jquery selector statement for search box

ngungongungo Posts: 64Questions: 23Answers: 2

Hi,
I've been struggled for awhile :). The search box has no class nor id, how do I jquery select the input to get or set its placeholder? Any tips appreciated. Thanks.

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    This example creates a custom search event from the default search input:

          $('.dataTables_filter input')
           .off()
           .on('keyup', function() {
              $('#example').DataTable().search(this.value, false, false).draw();
           });    
    

    Kevin

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Setting a placeholder can be done using the language.searchPlaceholder option. If you need to access the element directly, use the selector Kevin suggests.

    Allan

This discussion has been closed.