Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>For newer browsers (IE>9):</strong> </p> <pre><code>&lt;input type="text" id="userName" placeholder="User Name" /&gt; </code></pre> <p><strong>For older:</strong></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;Placeholder support&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;input type="text" id="userName" placeholder="User Name" /&gt; &lt;script src="../js/vendor/jquery-1.10.2.min.js"&gt;&lt;/script&gt; &lt;script src="../js/vendor/jquery-migrate-1.2.1.js"&gt;&lt;/script&gt; &lt;script src="../js/vendor/modernizr-latest.js"&gt;&lt;/script&gt; &lt;script src="../js/placeholder.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>placeholder.js (jQuery, Modernizr)</strong></p> <pre><code>var Placeholder = (function ($, document) { /* Static Content */ var _$document = $(document); /* Events */ var _initPlaceholders = function () { _$document.find('input:text').each(function () { var $this = $(this); $this.css({ color: '#888' }).val($this.attr('placeholder')); }); }; var _placeholderEvent = function () { var $input = $(this), placeholderValue = $input.attr('placeholder'); if ($input.val() === placeholderValue) { $input.css({ color: '#000' }).val(''); return; } if ($input.val() === '') { $input.css({ color: '#888' }).val(placeholderValue); } }; var _bindEvents = function () { if (!Modernizr.input.placeholder) { _initPlaceholders(); _$document.on('focus blur', 'input:text', _placeholderEvent); } }; var init = function () { _bindEvents(); }; return { init: init }; })(jQuery, document); Placeholder.init(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload