Home › Forums › CSS › JQuery validator not working in WordPress › Re: JQuery validator not working in WordPress
January 21, 2011 at 10:17 pm
#64595
Alan_Breck
Participant
Wait… hold the presses! I’m still running into a problem…
When using the Google jQuery library, the hover effect does not work, so I simply replaced that URL to one that points to the original library on the server – worked fine. However, I’m still having validation issues. It validates the e-mail field to make sure a valid e-mail address is typed, but it doesn’t not notify you if you don’t fill in your name and city.
Here is the code from the contact page –
functions.php –
if (!is_admin()) {
wp_deregister_script('jquery'); //Stop WordPress default jQuery
wp_register_script('jquery', '/wp-content/themes/priest/js/jquery-1.2.6.min.js', false, '1.2.6'); //Load Googles jQuery
wp_enqueue_script('jquery');
//Load jquery plugin
wp_register_script('jquery_validator','/wp-content/themes/priest/js/jquery.validate.js', 'jquery', '1.0'); //'jquery' is passed as a reference so that this loads AFTER 'jquery'
wp_enqueue_script('jquery_validator');
//Load custom script
wp_register_script('custom','/wp-content/themes/priest/js/page.js', 'jquery_validator', '1.0'); //'jquery_validator' is passed as a reference so that this loads AFTER the plugin
wp_enqueue_script('custom');
}
…and the header –
Thank you again for your time!
~A.B.
BTW: I took your advice on using an external JS file for the hover effect; thank you for that input!