I am working on jQuery validation plugin. On click of the submit first it has validate and first form and show custom error message and once the values are entered then if i click submit it has hide the first form and show the second form.
Here is my HTML Code for that
<form id="form1" method="post">
<div id="div_form1">
<input type = "text" id="txt_fname" name="txt_fname"/>
<select id="opt_sel" name="kindly select the value">
<option>
Select
</option>
<option>
Bananana
</option>
</select>
<button id="btn_form">Submit</button>
</div>
<div id="div_form2">
<input type = "text" id="txt_lname" name="txt_lname"/>
<select id="opt_sel" name="kindly select the value">
<option>
Select
</option>
<option>
Bananana
</option>
</select>
<button id="btn_form1">Submit</button>
</div>
</form>
<form id="form2" name="form2" method="post">
<div id="div_form3">
<input type = "text" id="txt_mname" name="txt_mname" />
<button id="btn_form3">Submit</button>
</div>
</form>
CSS
.error_field{
background-color:red;
color:black;
border:1px solid red;
}
jquery
$("#div_form2").hide();
$("#div_form3").hide();
$("#form1,").validate({
rules:{
txt_fname:{
required:true
}
},
messages :{
txt_fname:"Fill this field"
}
});
With this code the second form was hide and the first is getting validated but the option select field was not validating :( once the values or entered it was not submiting and it was not showing form2. Kindly help me as I am new to jquery i am struggling here a lot
Here is the fiddle Link
Thanks in advance.
Thanks & Regards Mahadevan