在我的表單中我有一個CheckBox
,並且我有一個CheckBox的標籤。在IE9中,CheckBox change event
按預期工作,但在IEIE7中,點擊標籤而不是複選框時觸發事件。單擊標籤時,複選框「更改」事件起作用。在ie8中,ie7
我的HTML
<div class="item-container">
<div class="label-container">
</div>
<div class="textbox-container">
<input id="AddNewProductCategory" class="" type="checkbox" width="20px" height="20px"
value="1" name="addnewproductcategory" tabindex="1900" />
</div>
<div class="after-checkbox-label">
<label class="Verdana11-424039" for="AddNewProductCategory">
Add New Service Category</label>
</div>
</div>
我的jQuery
jq('#AddNewProductCategory').change(function(){
jq('#CategoryName').next('label[for=CategoryName]').remove();
jq('#Category').next('label[for=Category]').remove();
if (!jq('#AddNewProductCategory').is(':checked')) {
alert("in change");
jq('input[name="newcategory"]').val('');
jq('#CategoryName').hide();
jq('#store_category').hide();
jq('#Category').removeAttr('disabled');
}
else {
jq('#Category').attr('disabled', 'disabled');
jq('#CategoryName').show();
jq('#store_category').show();
}
});
你有什麼版本的jQuery? –
jquery versoin 1.3.2 –
根據此文檔http://api.jquery.com/change/: 「從jQuery 1.4開始,Internet Explorer中的更改事件泡泡,與其他現代瀏覽器中的事件一致。」 考慮更改jquery版本。 –