wp_enqueue_scripts and jQuery
-
Ok, I’m trying to use the jQuery-placehold script by jgarber (https://github.com/jgarber623/jquery-placehold) in order to be able fake the placeholder form attribute for older browsers. But I can’t seem to be able to load the script correctly, and I can’t really figure out what’s wrong. I’m not 100% on PHP syntax, so I’m guessing it’s probably something wrong there.
I’ve put this in the <head></head> of my header.php file (before the wp_head(); call )
<?php function place_method() { // register your script location, dependencies and version wp_register_script('jquery.placehold', get_template_directory_uri() . '/js/jquery.placehold.js', array('jquery'), '1.0' ); // enqueue the script wp_enqueue_script('jquery.placehold'); } add_action('wp_enqueue_scripts', 'place_method'); ?> <script type="text/javascript"> jquery().ready( function() { jquery( "input, textarea" ).placehold( "something-temporary" ); }); </script>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘wp_enqueue_scripts and jQuery’ is closed to new replies.