Question: i have 2 lines jquery. first line is adding event on "myLink" and second line adding class "myLink" on "#another" but event is not working in second one but when i am using .live method then it is wokring. jquery introduce .on method in its 1.7 version. i want to do that it by .in function is this possible.

```
$(function(){

    $("a.myLink").on('click', function() { alert( 'Click!' ); } );

    $("a#another").addClass( "myLink" );
})

<a class="myLink">A link!</a>
<a id="another">Another link!</a>

```

Answer: 
Change this - 

```
$("a.myLink").on('click', function() { alert( 'Click!' ); } );

```

to this - 

```
$(document).on('click', 'a.myLink', function(){ alert( 'Click!' ); } );

```
Your clue is that it works with the live method. It works then because you are adding the class to '#another' after already setting the event. So you either have to use the live method or switch the order so that the class is added to 'another' first.