0
我有一個文本框#Email,我有兩個下拉列表菜單是#Carriers和#Phones。當輸入電子郵件時,我想只啓用運營商下拉框,但不是電話。當選擇運營商時,必須啓用電話下拉列表。電話下拉列表只能在選擇電子郵件和運營商時啓用。如果用戶輸入電子郵件並從#carriers和#phones中選擇一個項目,然後刪除電子郵件,則必須禁用兩個下拉菜單。有沒有辦法可以做一個複合句子?以下是輸入電子郵件時的工作承運人。如何在文本框中包含數據和下拉列表時選擇啓用第二個下拉列表?
$(document).ready(function() { //Will check for e-mail and enable #Phones dropdownlist, otherwise, it will disable dropdownlist of #Phones
$('#Email').on('input change', function() { //check to see if email textbox is empty
if ($(this).val() == '') {
$('#Phones').prop('disabled', true);
}
else {
$('#Phones').prop('disabled', false);
}
});
});
需要這包括#Phones & &載波數目
<script>
$(document).ready(function() {//need this to enable when email and carriers is selected.
$('#Email').on('input change', function() { //check to see if email is empty
if ($(this).val() == '') {
$('#Phones').prop('disabled', true);
}
else {
$('#Phones').prop('disabled', false);
}
});
});
嗯..我使用了底部聲明,但是當我刪除電子郵件地址時,#Carries禁用而不是#Phones。它現在的工作方式是,用戶輸入電子郵件和#carriers啓用,用戶選擇#carriers和#phones啓用項目。當我擦除#電子郵件時,禁止#載體但#電話仍處於啓用狀態。 – Sandy2016
編輯我的答案。第二個功能添加了「#電子郵件」。你現在可以檢查一下嗎? – ReadyFreddy
我希望它工作的方式是,當用戶從#carriers和#phones中選擇項目,然後刪除電子郵件時,必須禁用下拉菜單。目前,#運營商只會禁用而不是#電話。 – Sandy2016