jquery - disable links on dynamically created elements -


i have app can create elements, i.e. text-element , append div

and can add link element.

but can't disable link within div (not removing attr. disable it)

i looking this:

    $('#container a').click(function() {     e.preventdefault();     }); 

to disable links within div.container? possible?

you can use delegated events on method, designed handle exact situation you're describing:

$('#container').on('click', 'a', function(e) {    e.preventdefault(); }); 

Comments

Popular posts from this blog

php - Dynamic url re-writing using htaccess -

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -