Running jquery inside plugin admin page
-
This is a simple piece of jqeury I have picked up from JSFiddle:
$('.sample').on('click', function () { console.log(this); var choice = $(this); if (choice.is(":checked")) { $('#choices').append(choice.val() + " is checked!"); } });
Here is the html:
<div id="top-menu"> <input type="checkbox" class="sample" value="a">A</input> <input type="checkbox" class="sample" value="b">B</input> <input type="checkbox" class="sample" value="c">C</input> </div> <label>Choices</label> <div id="choices"></div>
And this is how I enqued jquery in my functions.php:
function load_jquery() { wp_enqueue_script( 'jquery' ); } add_action( 'wp_enqueue_script', 'load_jquery' );
But nothing works! I’v tried a number of other simple scripts for instance:
jQuery(document).ready(function(){ alert("Hello"); });
.. and still nothing.
Any help would be greatly appreciated.
Thank you
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Running jquery inside plugin admin page’ is closed to new replies.