Note that there are some explanatory texts on larger screens.

plurals
  1. POPlaceholders in IE that work with jquery validator
    primarykey
    data
    text
    <p>I'm trying to validate my html 5 form that uses placeholders in IE7 + 8.</p> <p>I used the valid() call from the Validation plugin for jquery. That means I cant use this solution: <a href="https://stackoverflow.com/questions/6066540/placeholder-issue-with-jquery-validate">placeholder issue with jQuery Validate</a>. My problem is the same though. The placeholder script I use adds the placeholder text to the value attribute. When the validation is called the script reads the placeholder text as valid input.</p> <p>I don't do full validation because the form is spread over several 'tabs' so needs to be validated before the next section is shown. This is non negotionalble</p> <p>My placeholder script:</p> <pre><code> $('[placeholder]').focus(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); input.removeClass('placeholder'); } }).blur(function() { var input = $(this); if (input.val() == '' || input.val() == input.attr('placeholder')) { input.addClass('placeholder'); input.val(input.attr('placeholder')); } }).blur(); $('[placeholder]').parents('form').submit(function() { $(this).find('[placeholder]').each(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); } }) }); </code></pre> <p>and here is where I call the validation:</p> <pre><code>if (elements.valid() === 0) { valid = 0; } if (valid) { $('.form').removeClass('error'); $(this).closest('section').hide().next().show(); } </code></pre> <p>Any help would be greatly appreciated!</p>
    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.
 

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