Exclude placeholders on validation in IE8
I'm using a jquery placeholder plugin to show placeholders in ie8. I'm also using jquery live validation for validating my forms. Now in IE8 all the placeholders are taken as values. In my form, phone number is not mandatory field, yet should be validated if user enters some value. Placeholder for my phone number field is "Phone Number" which is not valid as it becomes value in IE8. Please suggest me a way not to validate placeholders in iE8.
Now in iE8 if the user clicks submit without entering phone number field, live validation plugin is validating the phone number field taking placeholder as value.
You may want to read the docs before posting on SO:
The plugin automatically adds class="placeholder" to the elements who are currently showing their placeholder text.
So, if your user enters a phone number, the placeholder
class will be removed by the plugin. You can check for that class using $("input#phoneNumber").hasClass("placeholder")
.
上一篇: IE中的持久占位符
下一篇: 在IE8中排除占位符验证