Strict Standards: Only variables should be passed by reference in /home/adrane3/public_html/phpjquery/template.php on line 9
jQuery Click functions - making stuff happen

Binding CLICK events

Users interact with webpages by clicking on different elements. jQuery allows us to easily add to, or change the behavior of the links we click on.

If you want to override the functionality of an anchor link, you must return false at the end of the function. Even if your href=#, you will want to return false so the screen doesn't jump!

You can also UNBIND clicks - this is very important if you want to change the click functionality.

To unbind a click, simply use .unbind('click').click( ... )

more...

Run

Clear

  • Adding (or binding) a click
  • unbinding the click
  • Changing the click
  • another way of binding the click
  • THIS - accessing the information of the thing you clicked
  • Another reason to use return false
  • Another way to prevent the default click action