私はワードプレスを使用しています。ワードプレスでは、フォームをライブ検証したいと思います。したがって、さまざまなjQueryフォーム検証を検索した後、 http://www.geektantra.com/projects/jquery-form-validate/リンクを取得しました。私は自分のサイトのすべてのソースコードを使用しました。しかし、その後、ページをレンダリングすると、Chromeコンソールタブでこのエラーが発生しました
Uncaught TypeError: Object [object Object] has no method 'validate' localhost:70
(anonymous function) localhost:70
o jquery.js:2
p.fireWith jquery.js:2
e.extend.ready jquery.js:2
c.addEventListener.B
私のjqueryファイルはすべてこのようなヘッダーファイルに含まれています
<?php
wp_enqueue_script('jQuery', get_bloginfo('template_url').'/js/jquery-1.3.2.min.js');
wp_enqueue_script('Validations', get_bloginfo('template_url').'/js/jquery.validate.js');
wp_enqueue_script('Validations Function', get_bloginfo('template_url').'/js/jquery.validation.functions.js');
?>
頭の中のjQueryコードは次のようになります
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#ValidTitle").validate({
expression: "if (VAL != '0') return true; else return false;",
message: "Please make a right selection for the title"
});
jQuery("#Name").validate({
expression: "if (VAL) return true; else return false;",
message: "Please enter your name"
});
jQuery("#BusinessPhone").validate({
expression: "if (VAL.match(/^[9][0-9]{9}$/)) return true; else return false;",
message: "Should be a valid Phone Number"
});
jQuery("#ValidEmail").validate({
expression: "if (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/)) return true; else return false;",
message: "Please enter a valid Email ID"
});
jQuery("#NumberOfEmployee").validate({
expression: "if (!isNaN(VAL) && VAL) return true; else return false;",
message: "Please enter a valid number of employees"
});
jQuery("#ValueSoftware").validate({
expression: "if (VAL != '0') return true; else return false;",
message: "Please make a right selection for Value Software"
});
jQuery("#TaxYear").validate({
expression: "if (VAL != '0') return true; else return false;",
message: "Please make a selection"
});
});
</script>
誰かがこれを解決する方法を親切に助けてくれますか?それは本当に認められるでしょう。