HTML5 placeholder Attribute

May 28th, 2012 by Laeeq | 4 comments

HTML5 has introduced many interesting and usefull features like semantic tags , javascipt API’s form, Audio, video and many more. among them one of my favorites is the placeholder attribute to INPUT elements. The placeholder attribute shows text in a field until the field is focused upon, then hides the text.

As we had created placeholders for textboxes using javascript but it had a many probelm. actually when we set the value attribute initially, but, as soon as the user deletes that text and clicks away, the input will be left blank again. The HTML5 placeholder attribute has solved this issues.

HTML5 placeholder code:
  1. <input type=“text” name=“employee_first_name” placeholder=“Employee first name…”>  

Above in the html code I have used text of my choice that will be displayed in textbox design when page loaded. and also there will be no need of javascript to make it dynamic and effective.

You can subscribe to PHPZAG.COM posts by Email

 

Related Topics:

  • HTML5 Canvas Element
  • Popular Free HTML5 and CSS Templates
  • Web forms with new HTML5 features
  • HTML5 – The figure & figcaption elements
  • Simple Slider with HTML5 Range Input Type
  • What is HTML5?
  • New Elements in HTML5
  • XForms – The new Web standard for forms
  • Magento Interview Questions and Answers
  • HTML5 interview questions and answers
  • About HTML5 Audio Standards
  • HTML 5 compatible browsers
  • Php Interview Questions and Answers – Part 1
  • Php Interview Questions and Answers – Part 2
  • Php Interview Questions and Answers – Part 3
  • PHP Interview Questions and Answers – Part 4
  • Php Interview Questions and Answers – Part 5
  • Php Interview Questions and Answers – Part 6
  • Php Interview Questions and Answers – Part 7
  • Php Interview Questions and Answers – Part 8
  •  

     

    1. No comments yet.
    1. June 2nd, 2012 at 18:57 | #1
    2. June 2nd, 2012 at 19:02 | #2
    3. June 3rd, 2012 at 15:24 | #3
    4. June 3rd, 2012 at 15:35 | #4