0

I have written some click events on document.ready(). Some of them are working as expected. But few of them are not loading unless i put them inside setTimeout().

It is not working

$('.clsName').click(function(){ //code here   });

But, this one will work

setTimeout(function(){
    $('.clsName').click(function(){ //code here});
}.2000);
Pang
  • 9,073
  • 146
  • 84
  • 117
vikash5472
  • 200
  • 2
  • 15

1 Answers1

1

try this

$(document).on('click','.clsName',function(){ //code here   });
FishMan
  • 127
  • 1
  • 10
  • **From review queue**: May I request you to please add some more context around your answer. Code-only answers are difficult to understand. It will help the asker and future readers both if you can add more information in your post. – RBT May 08 '17 at 08:33