Access to elements in wordpress
-
The following code was added to the foot:
<div id="mc_embed_signup" class="popup_sub"> <div class="close"></div> <form action="http://6thsenseofstyle.us11.list-manage.com/subscribe/post?u=de7f17faa1d129bd23631fd8f&id=f2be059297" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> <div id="mc_embed_signup_scroll"> <h1 class="popup_title">6th Sense Of Style Newsletter</h1> <div class="popup_border"></div> <div class="popup_text"> <p>Sign up to our newsletter to get the latest articles, lookbooks & street style photography direct to your inbox:</p> </div> <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups--> <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_de7f17faa1d129bd23631fd8f_f2be059297" tabindex="-1" value=""></div> <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button popup_submit"></div> </div> </form> </div> <script type="text/javascript"> $('.popup_sub .close').click(function(){ $('.popup_sub').hide(); });
setTimeout(function(){
if (!$.cookie('subscribed')) {
$('.popup_sub').show();$('.popup_sub form').submit(function(){ $.cookie('subscribed', true, { expires: 365, path: '/' }); }); }
}, 30000);
</script>In the end, the console gets a mistake "Uncaught TypeError: Cannot read property 'click' of undefined," that's the first line of the code. I tried to get console.log.
-
$ is not defined - it's written, you just didn't connect the jQuery library.
Error{ "message": "Uncaught ReferenceError: $ is not defined", "filename": "http://stacksnippets.net/js", "lineno": 28, "colno": 3 }
And, plus, turn everything on the script
$(document).ready(function(){
})