I want pass input class name to keyup event, but onkeyup="filter(this)" also got error
how to pass it?
$('.dropdown-select ul').before('<div class="dd-search"><input id="txtSearchValue" autocomplete="off" onkeyup="filter()" class="dd - searchbox" type="text"></div>');
$('.dropdown-select ul').before('<div class="dd-search"><input id="txtSearchValue" autocomplete="off" onkeyup="filter('+this.classname+')" class="dd - searchbox" type="text"></div>');
To pass the class name of the input element to the filter function in jquery keyup event, you can use jquery event handling methods rather than inline event handlers.