Today, we encountered this problem when submitting our form, so we can solve it with the legendary jquery.
Here we mainly talk about the focus issue in IE, because it is supported in firefox
Copy codeThe Code is as follows:
Input: focus
Textarea: focus
In IE: the focus is invalid. Therefore, we need to add a new style to the input and textarea after clicking to achieve the focus effect.
Let's first look at the effect:
Let's take a look at the JS in this effect:
<Script language = "javascript">
$ (Document). ready (
Function () {if ($. browser. msie ){
$ ("Input [@ type = 'text'], input [@ type = 'Password'], textarea "). focus (function () Publish messages (this).css ({background: "# FFFFF7 "});})
$ ("Input [@ type = 'text'], input [@ type = 'Password'], textarea "). blur (function () implements callback (this).css ({background: "# fff "});})
}});
</Script>
CSS is defined as follows:
Input, textarea {border: 1px solid # CCC ;}
Input: focus, textarea: focus {background: # FFFFF7 ;}
This is a very simple application of jquery. I am also a beginner and have a lot of discussions...