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>