javascript - Validating forms involving textarea -
i trying use jquery technology validate web forms(i learning now). after downloading , referencing files in code, textarea stubbornly refused validated after assigning required class attribute. pls help. apologies, if it's trivial. here's code:
<script type ="text/javascript" src = "jquery.js"></script> <script type ="text/javascript" src ="jquery.validate.js"></script> <script type ="text/javascript"> $(document).ready(function(){ $("#reg").validate(); })// end of ready()
from code:
<form id = 'reg' method ='post' action =''> <label 'username'>user name **</label> <input type ='text' name ='username' id ='usn' class = 'required' title = "enter name"><br/> <label 'address'> address **</label> <input type ='text' id ='addr' class = 'required' title = "enter address"><br/> <label 'comment'>comment below **</label> br/> <textarea id ='comm' rows =5, cols = 18 class ='required' title = 'make comment'></textarea><br/> <input type ='submit' id = 'button1' value = 'send'> </form>
you have add unique name
attribute each input/textarea element.
the name attribute required input elements, validation plugin doesn't work without it.
Comments
Post a Comment