Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I ran into a similar issue. Have you gotten yours to work? I'd love to compare notes.</p> <p>FWIW, here's what I did:</p> <p><a href="http://jsfiddle.net/dido/n7wZ7/">jsfiddle demo here</a>.</p> <p><strong>Add input placeholders to the jQuery support object:</strong></p> <pre><code>$.support.placeholder = (function() { var i = document.createElement( 'input' ); return 'placeholder' in i; })(); </code></pre> <p><strong>The placeholder chain:</strong></p> <pre><code>$('input') .addClass('hint') .val( function() { if ( !$.support.placeholder ) { return $(this).attr('placeholder'); } }) .bind({ focus: function() { var $this = $(this); $this.removeClass('hint'); if ( $this.val() === $this.attr('placeholder') ) { $this.val(''); } }, blur: function() { var $this = $(this), // Trim whitespace if only space characters are entered, // which breaks the placeholders. val = $.trim( $this.val() ), ph = $this.attr('placeholder'); if ( val === ph || val === '' ) { $this.addClass('hint').val(''); if ( !$.support.placeholder ) { $this.val(ph); } } } }); </code></pre> <p><strong>Add a new validation rule</strong></p> <p><a href="http://docs.jquery.com/Plugins/Validation/Validator/addMethod">addMethod docs</a></p> <pre><code>$.validator.addMethod('notPlaceholder', function(val, el) { return this.optional(el) || ( val !== $(el).attr('placeholder') ); }, $.validator.messages.required); </code></pre> <p><strong>Include the new method in the validate rules object</strong></p> <pre><code>$('form').validate({ rules: { name: { required: true, notPlaceholder: true }, email: { required: true, notPlaceholder: true, email: true } } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    3. 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