javascript - How to process click event of dynamically created hyperlinks? -


i have dynamically generated links

<a name="details" id="1" href="javascript:;">details</a>

when 1 of them clicked want process event javascript code this

$(document).ready(function () {     var = document.getelementsbyname('details').item(0);      a.on('click', function () {         $.ajax({             ///         });     }); }); 

however, though seems find hyperlinks quite perfectly, on click event doesn't enter function.

what wrong implementation?

on method find on jquery objects.

document.getelementsbyname('details').item(0) returns native dom element.

either use addeventlistener instead of on or $("some selector") instead of getelementsbyname & item.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

c++ - Migration from QScriptEngine to QJSEngine -

delphi - Take screenshot in webcam using VFrames in Console Application -