gpt4 book ai didi

javascript - jQuery 脚本在 Internet Explorer 10 中不起作用

转载 作者:行者123 更新时间:2023-11-28 08:24:14 24 4
gpt4 key购买 nike

当我选择需要激活按钮的选项时,它适用于所有浏览器(IE10 除外)。

选择html:

<select id="tenants" name="tenants" size="10" class="reportOption" onchange=""> 
<option value="DSF-sdfdsfdsf" id="9" onclick="">DSF-sdfdsfdsf</option>
<option value="HLQ - Harlequin North America" id="6" onclick="">HLQ - Harlequin North America</option>
<option value="HMB - Harlequin Mills and Boone" id="7" onclick="">HMB - Harlequin Mills and Boone</option>
<option value="HQA - Harlequin Australia" id="8" onclick="">HQA - Harlequin Australia</option>
<option value="KPC - Kensington" id="5" onclick="">KPC - Kensington</option>
<option value="LDD - Libre Digital Inc." id="1" onclick="">LDD - Libre Digital Inc. </option>
<option value="SCH - Scholastic Inc." id="2" onclick="">SCH - Scholastic Inc.</option> <option value="SSH - Simon and Shusterman" id="4" onclick="">SSH - Simon and Shusterman</option>
</select>

按钮 html:

<div class="reportsButtons left_setup_buttons">
<input type="button" id="addCtgBtn" class="button setup_btn" value="New"/>
<input type="button" id="editCtgBtn" class="button setup_btn disabled" disabled value="Edit" onclick="showAddCategoryForm(this);"/>
<input type="button" id="delCtgBtn" class="button setup_btn disabled" disabled value="Delete" onclick="deleteCategory(this);"/>
</div>

还有我的 JS:

$("#categories option").click(function(){
$("#categories option").removeClass('selected');
$(this).addClass('selected');

selectedCategoryId=$(this).attr('id');
selectedCategoryName = $(this).attr('value');

$('#editCtgBtn, #delCtgBtn').removeAttr("disabled").removeClass("disabled");
$("#addCtg").hide();
});

最佳答案

尝试更改而不是点击..

         //$("#categories")
$("#tenants").change(function(){
var selectedOption = $(this).find("option:selected");
$(this).find('option').removeClass('selected');
selectedOption.addClass('selected');

selectedCategoryId=selectedOption.attr('id');
selectedCategoryName = $(this).val();

$('#editCtgBtn, #delCtgBtn').removeAttr("disabled").removeClass("disabled");
$("#addCtg").hide();
});

关于javascript - jQuery 脚本在 Internet Explorer 10 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22616031/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com