I have the following which doesn’t work
$('#select').val( jQuery.url.param("id") );
$('#button').click();
It seems that the click executes before the line above it finishes. How do I ensure that the first line is finished before the click gets executed?
As the click action depends of the value in the select control being set. I am currently getting results based on the first option in the select control.
JavaScript is single threaded. Since none of the code above seems to have any side effects (like starting AJAX requests), the second command is executed after the first. This means something else must be wrong.
Try this:
$('#select')actually matches something?$('#foo').val(...);will not cause an error but do nothing instead.