I have a form that the client wants labels inside the input field, and I decided to use HTML 5 placeholder and Google html5shiv instead of the old javascript instead. However, my placeholders do not work properly in IE, for which I use shiv. Here is the code:
Doctype:
<!DOCTYPE html>
Shiv:
The form:
<form method="post" enctype="multipart/form-data" name="contactForm" id="contactForm"> <input type="text" name="name" id="name" placeholder="Your Full Name..." /> <input type="text" name="telephone" id="telephone" placeholder="Your Telephone Number..." /> <input type="email" name="email" id="email" placeholder="Your Email Address..." /> <textarea name="enquiry" id="enquiry" placeholder="Your Enquiry or Comments..."></textarea> <p class="midpadLeft green_Button_margin_2"><span class="green_Button_2"><a href="javascript: document.contactForm.submit();" target="_self" class="green_Button_2">Submit Enquiry <img src="images/mid-envelope.png" alt="Submit"/></a></span></p> </form>
Any ideas as to why it is not working?
Revision:
Using the code suggested in the comments below, I changed my code to the following, but it still doesn't work.
Script including (the contents of this script have been copied directly from here ):
<script type="text/javascript" src="scripts/placeholders.js" charset="utf-8"></script>
DOM ready event listener:
<body onload="Placeholders.init(true);">
source share