Robus Robus - 2 months ago 6x
jQuery Question

When does the jquery change function trigger?

Referring to this post: Jquery execute onchange event on onload

I got the opposite Problem.

This was my first attempt but the function executes on page load

I excpected it to trigger on the first change.

function get_items(){

This one works and there is only an alert if i really change the select_field:


It is probably some basic stuff but i cant find anything helpfull.
Can someone pls explain whats happening here?

Thank you


$('#select_field').change(get_items()); should be $('#select_field').change(get_items);

Binding event handlers requires passing a function reference. When you call get_items() you're executing the function.