There is no text box in JQuery to highlight this plug-in. I wrote a plug-in today and posted the code to share the Code as follows:
Jquery-highlight.js
The Code is as follows:
/*
Description: TextBox HighLight
Author: Allen Liu
*/
(Function ($ ){
$. Fn. highlight = function (options ){
Var defaultOpt = {
LightColor: 'yellow',/* color when highlighted */
LightTime: 1000,/* highlight duration (unit: milliseconds )*/
IsFocus: true/* Whether to obtain the focus */
};
Options = $. extend (defaultOpt, options );
Return this. each (function (){
Var sender = $ (this );
If (sender. attr ('light') = undefined ){
Var _ bgColor = sender.css ('background-color ');
Sender.css ({'background-color': options. lightColor });
If (options. isFocus ){
Sender. focus ();
}
Sender. attr ('light', true );
Window. setTimeout (function (){
Sender. removeAttr ('light ');
Sender.css ({'background-color': _ bgColor });
}, Options. lightTime );
}
});
}
}) (JQuery );
Html code:
The Code is as follows:
Call method:
The Code is as follows: