Is it possible to set a color of a specific input field using jquery?
I would like to set a border to red if it fails some validations that I wrote and turn it back to black if it is fine.
Any way to do this?
in your validation code, set the field with the error
$('#afieldID').addClass("error");
in your validation code, set the field with no error
$('#afieldID').removeClass("error");
stylesheet code
.error {
border: solid 2px #FF0000;
}
why do people always want to write there own code what do they think they are programmers ;^ ) you should consider validation plugin
I would do something like
$('#item_id').addClass('errorClass');
that was you can add put it all in classes and swap as needed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With