0

I have this code:

<head>
<script>
$(document).ready(function(){   
  $('form').validate({
          rules: { 'input_name': { email: true} },
          messages: { 'input_name': "Is not an email" }          })      });   
</script> 
</head>
<body>
 <form id="clar">
 Escribe ALGO <input name='input_name' type="text" ">     
   <input type="submit" >  
</form>

If I dont insert a email addres, an error is showed, and.. the class "error" is added to the input element.

Why is added that class to the input? How to avoid it?

Regards

Javi

1 Answer 1

1

Clearly the plugin (which you dont link to or show any source from) is designed to add a class of 'error' to the input when it fails, probably so you can use CSS to turn it red, or bold, or whatever to highlight the problem to a user.

If you don't want it to do anything, just don't define any CSS for 'error' and nothing will happen.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.