0

I have some code like this. When I did not put any input in last name or first name and click submit button, it shows me the red color in border. I know that's because I use required in both of them. But I am wondering is there a way to change that red color to other colors (like green for example)?

<body>
<form id="form">
<input id="LastName" type="text" placeholder="Last Name" required/>
<input id="FirstName" type="text" placeholder="first Name" required/>
<input type="submit" id="sub" value="save">
</form>
</body>
DiedinGraz
  • 25
  • 6
  • Take a look at this post which change a custom validation message https://stackoverflow.com/questions/5272433/html5-form-required-attribute-set-custom-validation-message – Alan M Dec 19 '19 at 17:28
  • In your case you get red color in the border so it may help – Alan M Dec 19 '19 at 17:30
  • I was trying to answer then your question got closed lmao. Just use input:invalid{ //customize it here } in your css or style tag and you're done. :) – RickJo Dec 19 '19 at 17:40

0 Answers0