javascript - JQuery applying change for each select element in a div section -


i getting following error:

typeerror: callback.call not function

value = callback.call(obj[i], i, obj[i]);

with following code:

$("#pagingdetails select").each($(this).change(refreshsearchresults)); $("#peoplesearchfilter select").each($(this).change(refreshsearchresults)); $("#peoplesearchfilter input:checkbox").each($(this).click(refreshsearchresults)); 

where function refreshsearchresults makes ajax request server new search results based on search criteria or paging provided user through select , checkbox elements in thepagingdetails div , personsearchfilter div.

what don't wrong?

thanks,

-frinny

you not need loop stack, can bind on jquery object

$("#pagingdetails select").change(refreshsearchresults); $("#peoplesearchfilter select").change(refreshsearchresults); $("#peoplesearchfilter input:checkbox").click(refreshsearchresults); 

also, documentation say, .each() need function argument, not "action".

for future reference, working code (event if useless) :

$('selector').each(function(){     $(this).change(function); }) 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -