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

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -