title: jquery: get value of custom attribute
body: <p>html5 supports the placeholder attribute on <code>input[type=text]</code> elements, but I need to handle non-compliant browsers. I know there are a thousand plugins out there for placeholder but I'd like to create the 1001st.  </p>
  
  <p>I am able to get a handle on the <code>input[placeholder]</code> element but trying to get the value of the placeholder attribute is returning undefined -  <code>$("input[placeholder]").attr("placeholder")</code>.</p>
  
  <p>I'm using jquery 1.6.2.</p>
  
  <p>Here is the <a href="http://jsfiddle.net/mkYCN/1/" rel="noreferrer">jsfiddle</a>. I modified the code to work in a browser that is html5 compatible just for testing purposes.</p>
  
  <p>html </p>
  
  <pre><code>&lt;input type="text" name="email" size="10" placeholder="EMAIL ADDRESS"&gt;
  </code></pre>
  
  <p>jquery</p>
  
  <pre><code>function SupportsInputPlaceholder() {
      var i = document.createElement("input");
      return "placeholder" in i;
  }
  
  $(document).ready(function(){
      if(!SupportsInputPlaceholder()) {
          //set initial value to placeholder attribute
          $("input[placeholder]").val($("input[placeholder]").attr("placeholder"));
  
          //create event handlers for focus and blur
          $("input[placeholder]").focus(function() {
              if($(this).val() == $(this).attr("placeholder")) {
                  $(this).val("");
              }
          }).blur(function() {
              if($(this).val() == "") {
                  $(this).val($(this).attr("placeholder"));
              }
          });
      }
  });
  </code></pre>
  
  <p>Thanks for any and all help,
  B</p>