jQuery .click();

Event handler that gets attached to a jQuery object thats targeting an element… i.e. $(h4).click(); The above triggers when you click on a h4 tag, but to get it to...

Event handler that gets attached to a jQuery object thats targeting an element… i.e.

$(h4).click();

The above triggers when you click on a h4 tag, but to get it to actually do something, you need to add a function… i.e.

.click(function({ //do something }));

Or a full example…

$(h4).click(function(){
    $(this).css("background", "#000000");
});

Related posts:

  1. Powerful jQuery Tag Selectors
  2. More powerful jQuery selectors
  3. Adding jQuery to your page
  4. jQuery Photo Reflections
  5. To ‘Get’ an element in jQuery

This post has had 15 views

Tags: ,