php - jquery dont work on my plugin wordpress when user logged in, but work very well when user or admin not logged in -
php - jquery dont work on my plugin wordpress when user logged in, but work very well when user or admin not logged in -
i working jquery , wordpress plugin.
jquery(document).ready(function($) { $('.btn').click(function(){ alert("hello world"); }); }); this code working when run on site usual visitor, reject work when logged in on wordpress site.
is there wrong in code perchance create problem happen?
any help appreciated. in advance..
edit : after seek open consol, seek come in code above , run via console. , seek click button again, code working. dont understand why. since js file there, included the
that mean --if i'm not wrong -- code there, function
jquery(document).ready(function($) { ...... }); not executed when document ready. why when seek run via console. programme run when not logged in.
after serveral seek , error , googling , inquire , bothering many people, alter mothod used self execution function. 1 said jquery(document).ready(function(){}) fail somehow (about async or something, can't remember) decide alter jquery(document).ready(function(){}) to
(function($){ alert("hello"); })(jquery); this work me. write reply people facing same problem give try..
php jquery wordpress
Comments
Post a Comment