jquery - preventDefault doesn't work on some links -


i've been writing extension disables links on pages through following code:

$('a[href]').each(function() {              $(this).on('click.kill', function(e)             {                 e.preventdefault();             })         }) 

however, on websites i.e. news.yahoo.com, of links remain active after above script has run (for example, "get new yahoo! mail apps" link @ top). possible reasons cause occur? (90+% of links disabled after above code runs)

edit:

as far know, links exist before script runs.

are links being added after script runs? if so, may need this:

$("body").on(     "click.kill",     "a[href]",     function(e) {         e.preventdefault();     } ); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -