Reprint: http://www.cnblogs.com/weeky/archive/2012/04/08/2438002.html
The following can be called directly, note: The Google.js of jquery citation
123<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>4<title>input loses focus and gets focus jquery Focus Event Plugin-lazy people build station </title>5<script src= "Http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type= "Text/javascript" ></ Script>6<script type= "Text/javascript" >7$ (document). Ready (function(){8 //Focusblur9Jquery.focusblur =function(focusid) {Ten varFocusblurid =$ (FOCUSID); One varDefval =focusblurid.val (); AFocusblurid.focus (function(){ - varThisval = $ ( This). Val (); - if(thisval==defval) { the$( This). Val (""); - } - }); -Focusblurid.blur (function(){ + varThisval = $ ( This). Val (); - if(thisval== ""){ +$( This). Val (defval); A } at }); - - }; - /*here's how to call the method*/ -$.focusblur ("#searchkey"); - }); in</script> - to +<body> -<form action= "" method= "POST" > the<input name= "" type= "text" value= "Enter search keywords" id= "Searchkey"/> *<input name= "" type= "Submit" id= "searchbtn" value= "Search"/> $</form>Panax Notoginseng<p>input loses focus and gets focus jquery Focus event plug-in, <br/><strong style= "color: #F00" > Mouse click in the search box when the text disappears </ Strong>. </p> - the</body> +The Change event for option in select:
1 $ ("#CSS_Font_Style"). Change (function2 changeevent (); 3
Get the contents of input:
1 var Css_border_width = $ ("#CSS_Border_Width"). Val ();
Get the content of option:
1 var Css_font_style = $ ("#CSS_Font_Style"). Find ("option:selected"). Text ();
jquery Dynamic Set CSS properties:
1 <div id = "divcss" >
$ (". Divcss"). css ({2"Border-width": css_border_width+ "px",3"Background-color": Css_background_color,4"Background-position": Css_background_position,5"Background-size": Css_background_size,6"Border-color": Css_border_color,7"Background-image": Css_background_image,8"Font-weight": Css_font_weight,9"Font-size": Css_font_size,Ten"Line-height": Css_font_line_height, One"Font-family": css_font_family, A"Font-variant": Css_font_variant, -"Border-style": Css_border_style, -"Background-repeat": Css_background_repeat, the"Background-origin": Css_background_origin, -"Background-attachment": Css_background_attachment, -"Font-style": Css_font_style, -})
The input box gets the focus and loses focus, and the Select box Change event