Placeholder for the placeholder text box you just touched

web front end ten thousand seven hundred and thirty-five 13 years ago (2012-08-15)

I just saw a new attribute - placeholder

Usage:

HTML code
  1. < input   name = ""   type = "text"   placeholder = User name   />   

After adding the placeholder attribute to the text box, we browser You can see that the text box displays three characters of the user name. After entering characters, three characters of the user name will be deleted, and the three characters of the user name will be displayed again. This is a very good property, User experience It's very good, but it doesn't support IE browser. To achieve similar functions, IE browser can use the following code in addition to jquery:

HTML code
  1. < input   name = ""   type = "text"   onfocus = "Javascript: this. value=='User name '?  this.value='' : this.value"   onblur = "Javascript: this. value==''? This. value='User name ': this. value"   value = User name   />   

The official version of jQuery 1.8 has arrived. Here is a brief introduction to the updated content of jQuery 1.8:

1. Re architecture of Sizzle selector engine

2. Rebuild animation processing

3. Automatic CSS prefix processing

When you use CSS attributes in. css() and. animate(), jQuery will automatically set some prefixes according to the browser type. For example,. css ("user select", "none") will become "- webkit user select" in Chrome/Safari, In Firefox, it becomes "- moz user select", In IE10, it becomes "- ms user select"

4. More flexible $(html, props)

5. More than 160 bugs are solved and closed

6. Smaller code

7. Modularization

At the same time, jQuery 1.8 also removes some APIs. If you want to upgrade to this version, please read the official release notes.