Search
 
SCRIPT & CODE EXAMPLE
 

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" );
    }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: alphabetize text in javascript 
Javascript :: copy array of object in js 
Javascript :: window width onload jquery 
Javascript :: localstorage getitem 
Javascript :: js splice 
Javascript :: asking questions javascript in console 
Javascript :: js date format 
Javascript :: lite youtube embed react 
Javascript :: can be converted to number js 
Javascript :: how to edit a fil with vanilla js 
Javascript :: angularjs - controllerAs 
Javascript :: node express config file json 
Javascript :: vscode read environment variables 
Javascript :: check if array does not contain string js 
Javascript :: like dislike node js 
Javascript :: react this.state 
Javascript :: pug iterate array 
Javascript :: JavaScript Sorting Arrays 
Javascript :: async await react stackoverflow 
Javascript :: sum function in javascript 
Javascript :: javascript addeventlistener 
Javascript :: spotify uri 
Javascript :: javascript get first element of array 
Javascript :: javascript problem solving interview questions 
Javascript :: js iterating set 
Javascript :: moment get month day 
Javascript :: one line if statement javascript 
Javascript :: leaflet update marker icon 
Javascript :: create variable javascript 
Javascript :: flightphp 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =