У меня проблема с проверкой jQuery, которая не срабатывает в IE8. Все остальные браузеры работают отлично.Проверка jQuery и IE8
Я создал вырубать пример здесь:
http://www.gilkes.me.uk/jqueryvalidation/index.html
Вы можете видеть, что в IE9, Firefox, и т.д., сообщение проверки подсказке отображается, если кнопка нажата либо флажок снят.
В IE8 проверка не выполняется. Почему это?
Форма разметки:
<form action="http://www.google.com" method="post">
<div style="margin-top: 50px; text-align: left; margin-left: 30px;">
<ul>
<li style="list-style: none;">
<input class="checkbox" data-val="true" data-val-checkboxtrue="You must tick the box indicated." data-val-required="The QuestionAccepted field is required." id="Questions_0__QuestionAccepted" name="Questions[0].QuestionAccepted" type="checkbox" value="true" /><input name="Questions[0].QuestionAccepted" type="hidden" value="false" />
<strong>Question 1.</strong>
<input id="Questions_0__QuestionText" name="Questions[0].QuestionText" type="hidden" value="That you have been a United Kingdom resident for at least 6 out of the last 12 months." />
<input id="Questions_0__ValidationMessage" name="Questions[0].ValidationMessage" type="hidden" value="Please confirm that you have read and understood " />
<span class="field-validation-valid" data-valmsg-for="Questions[0].QuestionAccepted" data-valmsg-replace="true"></span></li>
<li style="list-style: none; margin-top: 30px;">
<input class="checkbox" data-val="true" data-val-checkboxtrue="You must tick the box indicated." data-val-required="The QuestionAccepted field is required." id="Questions_1__QuestionAccepted" name="Questions[1].QuestionAccepted" type="checkbox" value="true" /><input name="Questions[1].QuestionAccepted" type="hidden" value="false" />
<strong>Question 2.</strong>
<input id="Questions_1__QuestionText" name="Questions[1].QuestionText" type="hidden" value="That you are aged 74 or under." />
<input id="Questions_1__ValidationMessage" name="Questions[1].ValidationMessage" type="hidden" value="That you are aged 74 or under." />
<span class="field-validation-valid" data-valmsg-for="Questions[1].QuestionAccepted" data-valmsg-replace="true"></span></li>
</ul>
<p style="margin-top: 30px;">
<button type="submit" id="Continue" class="button-continue">
Buy Now
</button>
</p>
</div>
</form>
Я думаю, что может быть проблема с этим сценарием. Что-то в этом не работает orrectly с IE8:
<script type="text/javascript">
jQuery.validator.unobtrusive.adapters.add("checkboxtrue", function (options) {
if (options.element.tagName.toUpperCase() == "INPUT" && options.element.type.toUpperCase() == "CHECKBOX") {
options.rules["required"] = true;
if (options.message) {
options.messages["required"] = options.message;
}
}
});
</script>
Извините. Добавили соответствующий код сейчас. – FloatLeft