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: 20,276Questions: 26Answers: 4,765

    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: 61,665Questions: 1Answers: 10,096 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.