Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery event delegation

// Attach a delegated event handler
$( "#list" ).on( "click", "a", function( event ) {
    var elem = $( this );
    if ( elem.is( "[href^='http']" ) ) {
        elem.attr( "target", "_blank" );
    }
});
Source by learn.jquery.com #
 
PREVIOUS NEXT
Tagged: #jquery #event #delegation
ADD COMMENT
Topic
Name
7+2 =