Jquery:如果输入字段 editqstatus 值 = 1 或 2,想要禁用模式表单中的所有输入字段。
函数editMember(id = null) { 如果(id){
// remove the error
$(".form-group").removeClass('has-error').removeClass('has-success');
$(".text-danger").remove();
// empty the message div
$(".edit-messages").html("");
// remove the id
$("#member_id").remove();
// fetch the member data
$.ajax({
url: 'php_action/getSelectedMember.php',
type: 'post',
data: {member_id : id},
dataType: 'json',
success:function(response) {
$("#editqastatus").val(response.qastatus);
$("#editdisqreason").val(response.disqreason);
$("#editcampaignname").val(response.campaignname);
$("#editassettitle").val(response.assettitle);
// here update the member data
$("#updateMemberForm").unbind('submit').bind('submit', function() {
最佳答案
我不太确定你是否在谈论这个:
if ($("#editqastatus").val() == 1 || $("#editqastatus").val() == 2) {
$(".modal").find('input').attr('disabled', 'disabled')
} else {
$(".modal").find('input').removeAttr('disabled')
}
将“.modal”
替换为将输入包装在模态中的类。
关于javascript - jQuery : Want to disable all the input fields if editqastatus value = 1 or 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43815294/