I am trying to use a Jquery validation plugin called bassistance. I have wp_enqueue_script the script. I have loaded Jquery as I understand it's built into wordpress. I have included the <script>
tag so that I can .validate()
it . I have added the rules by adding class
to each field. This is all in one .php script, as I'm just learning. It doesn't seem to work. Please can someone advise? Has the <style>
tag been used wrongly?
add_action( 'wp_enqueue_script', 'load_jquery2' );
function load_jquery2() {
wp_enqueue_script( 'jquery' ); }
function add_my_css_and_my_js_files(){
wp_enqueue_script('jquery-validate-min', plugins_url('activate/jquery_validate_min.js', __FILE__ ) );
}
add_action('wp_enqueue_scripts', "add_my_css_and_my_js_files");
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#calsinput').validate();
});
</script>
function mp_calcs_display() {
return '
<form name="calsinput" action="" method="post" id="calsinput" >
<h1> Process </h1>
<p> operation type always robot </p>
<br> <br>
Number of welds: <input type="number" name="numberofwelds" class="required digits" title="This field is required and must be a no." >
<br> <br>
Number of construction welds: <input type="number" name="numberofconwelds" class="required digits" title="This field is required and must be a no.">
<input type="submit" value="Calculate cycle time ">
</form> ';
}