How to JQuery validators to HTML form input element?

46 Views Asked by At

currently, I am adding it in script on form submit

$("#formname").validate({ 
  //Rules ex
  rules:{
   nameoffield :{
    specialChar: true,
    email:true
                }
        }
 });

Can we add it in line? like

    <form:input name="nameoffield" path="" **specialChar** **email**/>

I want to move all the rules into a common JSP, include that JSP everywhere and just add the rules inline. TIA

0

There are 0 best solutions below