我試過尋找類似於我的其他問題,但沒有一個能幫助我。在IE8中顯示/隱藏不工作 - JQUERY
我有一些多個div,我需要顯示和隱藏時,用戶點擊一個輸入。我的代碼適用於除IE8以外的所有瀏覽器,其中沒有任何事情發生,換言之,div不顯示。 請有人可以幫我解決這個問題嗎?
這裏是我的HTML
<div id="tabbedBox">
<form action="" method="">
<div class="tabbed" id="selectMe">
<input type="radio" target="1" id="pvl" name="radios" value="a" checked>
<label class="pvl" for="pvl">PVL</label>
<input type="radio" target="2" id="cvl" name="radios" value="b">
<label class="cvl" for="cvl">CVL</label>
<input type="radio" target="3" id="industrial" name="radios" value="c">
<label class="industrial" for="industrial">Industrial</label>
<input type="radio" target="4" id="distributor" name="radios" value="d">
<label class="distributor" for="distributor">Distributor</label>
</div>
<div class="pvlBox tabbedContent" id="div1">
<div class="select">
<input type="radio" id="installed" name="radios" value="" checked>
<label for="installed">Installed</label>
</div>
<span>Installed</span>
<div class="select">
<input type="radio" id="retail" name="radios" value="">
<label for="retail">Retail</label>
</div>
<span>Retail</span>
<div class="select">
<input type="radio" id="service" name="radios" value="">
<label for="service">Service Station</label>
</div>
<span>Service Station</span>
</div>
<div class="cvlBox tabbedContent" id="div2" style="display:none">
CVL CONTENT
<div class="select">
<input type="radio" id="installed" name="radios" value="" checked>
<label for="installed">Installed</label>
</div>
<span>Installed</span>
<div class="select">
<input type="radio" id="retail" name="radios" value="">
<label for="retail">Retail</label>
</div>
<span>Retail</span>
<div class="select">
<input type="radio" id="service" name="radios" value="">
<label for="service">Service Station</label>
</div>
<span>Service Station</span>
</div>
<div class="industrialBox tabbedContent" id="div3" style="display:none">
INDUSTRIAL CONTENT
<div class="select">
<input type="radio" id="installed" name="radios" value="" checked>
<label for="installed">Installed</label>
</div>
<span>Installed</span>
<div class="select">
<input type="radio" id="retail" name="radios" value="">
<label for="retail">Retail</label>
</div>
<span>Retail</span>
<div class="select">
<input type="radio" id="service" name="radios" value="">
<label for="service">Service Station</label>
</div>
<span>Service Station</span>
</div>
<div class="distributorBox tabbedContent" id="div4" style="display:none">
DISTRIBUTOR CONTENT
<div class="select">
<input type="radio" id="installed" name="radios" value="" checked>
<label for="installed">Installed</label>
</div>
<span>Installed</span>
<div class="select">
<input type="radio" id="retail" name="radios" value="">
<label for="retail">Retail</label>
</div>
<span>Retail</span>
<div class="select">
<input type="radio" id="service" name="radios" value="">
<label for="service">Service Station</label>
</div>
<span>Service Station</span>
</div>
<br/>
</form>
</div><!--/end tabbedbox-->
這裏是jQuery代碼:
$('#pvl').click(function() {
$('div[id^=div]').hide();
$('#div1').show();
});
$('#cvl').click(function() {
$('div[id^=div]').hide();
$('#div2').show();
});
$('#industrial').click(function() {
$('div[id^=div]').hide();
$('#div3').show();
});
$('#distributor').click(function() {
$('div[id^=div]').hide();
$('#div4').show();
});
});
什麼的jQuery版本你使用的是,jQuery的2.x不支持IE 8 – Esko
哦,真的,我使用的是最新版本。我應該使用哪個版本,Esa? – madameFerry
使用版本1.x,請看這裏http://jquery.com/download/ – Esko