Answers for "jquery onclick doesn't work on adding another id and removing the old id"

0

jquery onclick doesn't work on adding another id and removing the old id

//You need to use event-delegation, because you are register a event-listiner on an element that not exist by that time.

$('#unfollowAnchor').on("click", function(e){

  //has to be

$(document).on("click", '#unfollowAnchor',function(e){
Posted by: Guest on August-21-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language