Highlight the input field for error with jquery like twitter bootstrap
highlight, input, jquery, validation
Solution
try this
$('.validate').css({ "border": '#FF0000 1px solid'});
by replacing
$('.validate').attr('style', "border-radius: 5px; border:#FF0000 1px solid;");
Problem
I have the below sample html code, where i am trying to highlight the input field like input field validation in twitter bootstrap ``` <html> <head> $('#submit_form').submit(function(){ var vals = $('.validate').val() if (!vals) { console.log('Error exists'); $('.validate').attr('style', "border-radius: 5px; border:#FF0000 1px solid;"); $('.validate').val('enter a value'); } }); </head> <body> <form action="" method="post" id="submit_form"> <div> <input class="validate" type="text" name="Name"/> </div> <input type="submit" value="Submit"> </form> </body> </html> ``` So by the above code the value `"enter a value"` is updating in the field, but the field is not highlighting Also when i checked whether the style attribute has added to input.. and yes it was added successfully but why the field is not highlighting