我实际上是在尝试修复某种令人讨厌的 IE BUG。
我创建了一个带有策略复选框和提交按钮的 html 表单。只要策略复选框未被“选中”,提交按钮就会被禁用。这一切都是我用 jquery 完成的。
奇怪的是,它在 chrome、ff 和 safari 中都运行良好,但在 IE 中,按钮失去“禁用”状态后,它停止工作。它仍然显示为链接,但是当我单击它时,什么也没有发生。
这是我用来禁用和启用按钮的脚本:
/* Webform/Newsletter Checkbox + Mailfield validation */
var mailCheckbox = $('#webform-component-e-mail #edit-submitted-e-mail-newsletter-selection div').size();
var copyCheckbox = $('.webform-client-form input#edit-submitted-email-abmeldung-1, .webform-client-form #webform-component-datenschutzbestimmungen input#edit-submitted-datenschutzbestimmungen-1').size();
if(mailCheckbox > 1) {
var submitButton = $('.webform-client-form #edit-actions').html();
$('.webform-client-form #edit-actions').html('<input disabled type="submit" class="form-submit-disabled" value="Bestellen" name="op" id="edit-submit">')
$('body').mousemove(function() {
if ($('#edit-submitted-e-mail-newsletter-selection .form-checkbox').is(':checked') && $('#webform-component-email-abmeldung .form-checkbox').is(':checked') && $('#webform-component-e-mail #edit-submitted-e-mail-newsletter-email-address').val() != "" ) {
$('.node-webform .webform-client-form #edit-actions').html('<input type="submit" class="form-submit" name="op" value="Absenden" id="edit-submit">')
$('.node-newsletter-anmeldung .webform-client-form #edit-actions').html('<input type="submit" class="form-submit" name="op" value="Bestellen" id="edit-submit">')
}
else {
$('.node-webform .webform-client-form #edit-actions').html('<input disabled type="submit" class="form-submit-disabled" value="Absenden" name="op" id="edit-submit">')
$('.node-newsletter-anmeldung .webform-client-form #edit-actions').html('<input disabled type="submit" class="form-submit-disabled" value="Bestellen" name="op" id="edit-submit">')
}
});
}
else {
var submitButton = $('.webform-client-form #edit-actions').html();
$('.webform-client-form #edit-actions').html('<input disabled type="submit" class="form-submit-disabled" value="Bestellen" name="op" id="edit-submit">')
$('body').mousemove(function() {
if ($('#webform-component-email-abmeldung .form-checkbox, #webform-component-datenschutzbestimmungen .form-checkbox').is(':checked') && $('#webform-component-e-mail #edit-submitted-e-mail-newsletter-email-address, #webform-component-webform-kontakt-email #edit-submitted-webform-kontakt-email').val() != "") {
$('.node-webform .webform-client-form #edit-actions').html('<input type="submit" class="form-submit" name="op" value="Absenden" id="edit-submit">')
$('.node-newsletter-anmeldung .webform-client-form #edit-actions').html('<input type="submit" class="form-submit" name="op" value="Bestellen" id="edit-submit">')
}
else {
$('.node-webform .webform-client-form #edit-actions').html('<input disabled type="submit" class="form-submit-disabled" value="Absenden" name="op" id="edit-submit">')
$('.node-newsletter-anmeldung .webform-client-form #edit-actions').html('<input disabled type="submit" class="form-submit-disabled" value="Bestellen" name="op" id="edit-submit">')
}
});
}
$('body.node-type-newsletter-anmeldung #edit-submit').attr('value', 'Bestellen');
$('body.node-webform #edit-submit').attr('value', 'Absenden');
知道如何解决这个问题吗?