Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Calling .val('') breaks placeholder functionality in certain scenarios #56

sbull opened this Issue · 1 comment

2 participants


In IE, calling .val('') on an input field can break the placeholder functionality, depending on when the .val('') is actually called.

The following code demonstrates the bug.

<!DOCTYPE html>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src="jquery.placeholder.js"></script>
    <script type="text/javascript">
    if (event.which === 13) {
      event.preventDefault(); // Silences bell, but not needed to demonstrate bug.
  Text: <input type="text" name="txt" placeholder="text holder"></input><br />
  Email: <input type="email" name="eml" placeholder="email holder"></input><br />
  Password: <input type="password" name="pwd" placeholder="password holder"></input><br />
<p>Press Enter in a Text or Email field to see the bug (in IE 9).</p>

My guess is that somehow the placeholder class doesn't get applied to the field again... perhaps it would be better to check the value of the field against the placeholder attribute in order to execute the placeholder functionality when the focus moves to a field?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.