I have a jQuery script that basically is changing my css when I click a link:
jQuery("a.adder").click(css_change());
My problem is that when I first load the page, the css_change() is being fired even when the link hasn’t been clicked. I know this for sure cause I changed the css_change() into alert("here") and that alert showed up. Anyone have any ideas as to why this is happening?
Is immediately executing the function upon binding.
Use:
(pass a reference to the function instead of the results of executing the function).