javascript - On adding the click event tracker using jquery on the document, the click event on a link is not working -


i have file listing , there option delete file. on clicking delete asks confirmation. on clicking confirm file deleted. please check jsfiddle that

https://jsfiddle.net/d6ds7ql2/1/

when add html click handler inorder change confirm text original delete text,

$('html').click(function(event){      if($('.confirmdelete').is(':visible')){          $('.confirmdelete').hide();          $('.deletelink').show();          return false;      } }); $('.confirmdelete').hide(); $('.deletelink').click(function (event) {     $(this).hide();     $('.confirmdelete').filter(':visible').each(function () {         $(this).hide();         $(this).prev('.deletelink').show();     });     $(this).next('.confirmdelete').show();     event.stoppropagation();     return false; }); 

https://jsfiddle.net/d6ds7ql2/2/

but issue on clicking 'confirm' text not going href hiding confirm text , showing delete text.

try instead of html, document.

$(document).not(".confirmdelete").click(function(event){     if($('.confirmdelete').is(':visible')){         $('.confirmdelete').hide();         $('.deletelink').show();         return false;     } }); $('.confirmdelete').hide(); $('.deletelink').click(function (event) {     $(this).hide();     $('.confirmdelete').filter(':visible').each(function () {         $(this).hide();         $(this).prev('.deletelink').show();     });     $(this).next('.confirmdelete').show();     event.stoppropagation();     return false; }); 

fiddle: https://jsfiddle.net/945j4g0x/


Comments

Popular posts from this blog

xml - Extract substrings with XSLT -

math - "ELO Rating" and how does "TSR Rating" work? -

How can do a tuple comparison in coffeescript similar to that in python? -