Gentlemen!
I'm composing a theme options page for my WP theme. And I bumped into the problem of finding the proper way to introduce inline jQuery interactions to the page.
Ideally for me in the situation will be inline jQ code
<script type="text/javascript">
$(document).on({
ready: function(){
alert('Hey!');
}
})
</script>
But this code fails because I guess the admin options page is rendered before the jQuery is included so js generates expected error. The same code with no jQ identifiers works ok means I get alert window when introduce:
<script type="text/javascript">
alert('Hey!');
</script>
Question is how to properly introduce inline js containing jQ (or any other framework) syntax and make it work?
alert('<? echo get_option("some-stuff"); ?>');
$
. Have you triedjQuery( document )
?jQuery(...)
did the trick! Thanks!! Can you publish it as an answer so I can mark it as helpful? Cheers!!