I have a form which generates textbox when the user selects "others" in dropdown..
Dynamic textbox generation was done and I can able to get the value of "others" textbox.
But my Problem is
1) I want to validate the others textbox when it was shown..
How to do the validation any Suggesstions please..
<form name="f2" id="f2" method="post" action="" enctype="multipart/form-data">
Type:
<select name="type" id="type" onchange='CheckColors(this.value);'>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="others">others</option>
</select>
<input type="text" name="others" id="others" style='display:none;'/>
<input type="submit" name="submit"/>
</form>
//Here is the script to validate the form..I want to validate the the other textbox when only it appears..How to do that?
<script type = "text/javascript">
$(document).ready(function () {
$("#f2").validate({
debug: false,
rules: {
type: {
required: true
},
others: {
required: true
},
messages: {
//messages for required
}
});
});
</script>
I tried the above process but it always shows the required filed two times side by side.