Hi i want to highlight a text box border color for few seconds , afterwards i want to change it back to white color. is ther a way for addClass function to specify time also. Any other way ?tried with http://jsfiddle.net/RW2s4/7/ not working
If you have only one textbox and id is known to you , you can use the @PanzerKadaver solution. Otherwise i would suggest to return in the json it self the ids of the textboxes which you want to make the red . Then loop through it and add the error class on the client side.
Highlight using the HTML5 <mark> tag If you are working on an HTML5 page, the <mark> tag can quickly highlight text. Below is an example of the how to use the mark tag and its result. If your browser supports the <mark> tag, "highlighted text" should have a yellow background.
This little script added the class 'highlight' for two seconds to the input field:
$('#text').change(function() {
var jElement = $(this);
jElement.addClass('highlight');
setTimeout(
function() { jElement.removeClass('highlight'); },
2000
);
});
Also see this example.
Or here the combination of your and mine solution.
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