JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container"></div>
JavaScript
// registering events in new nodes.
$( "#container" ).load(
"/echo/html/", // using jsFiddle echo service to return the
// html below (docs:
// http://doc.jsfiddle.net/use/echo.html)
{
html: "<div id='div_1'>Div 1</div>" +
"<div id='div_2'>Div 2</div>" +
"<div id='div_3'>Div 3</div>"
},
function( responseText, textStatus, xmlHttpRequest ){
if ( textStatus == "success" ) {
for ( var i = 1; i <= 3; i++ ) {
$( "#div_" + i ).click(function(){
alert( "You clicked in " + $(this).attr( "id" ) );
});
}
}
}
);