我正在处理一份不会在IE中提交的提交表单。我没有写代码,想知道是否有一些明显的东西在这里IE不喜欢。
$(function(){
{% if show_existing_form == False %}
$('#publisher-signup').toggle();
$('#existing-user-pub-signup').toggle();
{% endif %}
$('#new-user').click(function() {
$('#publisher-signup').toggle();
$('#existing-user-pub-signup').toggle();
});
$('#existing-user').click(function() {
$('#publisher-signup').toggle();
$('#existing-user-pub-signup').toggle();
});
var disable_submit = function() {
if ($('#publisher-submit').attr('disabled') !== 'disabled') {
$('#publisher-submit').attr('disabled', 'disabled');
}
};
var enable_submit = function() {
if ($('#publisher-submit').attr('disabled') === 'disabled') {
$('#publisher-submit').removeAttr('disabled');
}
};
var check_passwords_match = function() {
if ($('#password').val().trim() === '' || $('#confirm-password').val().trim() === '') {
disable_submit();
} else if ($('#password').val() !== $('#confirm-password').val()) {
$('#password-mismatch').show();
disable_submit();
} else {
$('#password-mismatch').hide();
enable_submit();
}
};
$('#confirm-password').change(check_passwords_match);
$('#password').change(check_passwords_match);
$('#email').change(function() {
$.ajax({
'url': '/preview',
'type': 'POST',
'data': {
'check-username': true,
'email': $('#email').val()
},
'success': function(data, textStatus, jqXHR) {
if (data.exists === true) {
$('#user-exists').removeClass('hide');
} else {
$('#user-exists').addClass('hide');
}
}
});
});
$('#existing-submit-btn').click(function(){
$('#publisher-existing-signup').submit();
});
$('#publisher-submit-btn').click(function(){
$('#publisher-purchase').submit();
});
});
答案 0 :(得分:1)
问题可能出在以下一个或两个方面:
$('#existing-submit-btn').click(function(){
$('#publisher-existing-signup').submit();
});
$('#publisher-submit-btn').click(function(){
$('#publisher-purchase').submit();
});
看起来某个表单上的提交按钮用于提交另一个表单,但第一个表单的默认操作永远不会被取消。尝试将其更改为:
$('#existing-submit-btn').click(function(){
$('#publisher-existing-signup').submit();
return false;
});
$('#publisher-submit-btn').click(function(){
$('#publisher-purchase').submit();
return false;
});