Find control with CSS class

jQuery provides a very cool mechanism to find the control of the page with the class name. Let's say you want to find out all the a tags which are having "sample" as Css class. jQuery has really made life simple for programmers.

Below given code does exactly the same thing. It also adds the click event to every a tag.

$(document).ready(function() {
 $("a.sample").click(function(){
     alert('clicked');
  });
});
Feel free to contact me for any help related to jQuery, I will gladly help you.
SHARE

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..