我用幾個選擇菜單和幾個jQuery隱藏和顯示函數創建了這個表單。表單應該工作的方式是,當你點擊主選擇菜單中的選項時,它會自動顯示相應的選擇子菜單。 這裏是我的代碼:爲什麼我的jQuery隱藏和顯示窗體選擇元素只能在Firefox中工作?
的jQuery:
$("#mankleding").bind("click",menclothes);
$("#manschoen").bind("click",menshoes);
$("#manaccessoires").bind("click",menaccessoires);
function menclothes(evt){
$("#subkledingheren").show("fast");
$("#subschoenenheren").hide("fast");
$("#subsaccessoiresheren").hide("fast");
}
function menshoes(evt){
$("#subkledingheren").hide("fast");
$("#subschoenenheren").show("fast");
$("#subsaccessoiresheren").hide("fast");
}
function menaccessoires(evt){
$("#subkledingheren").hide("fast");
$("#subschoenenheren").hide("fast");
$("#subsaccessoiresheren").show("fast");
}
HTML:
<tr>
<td> Artikel hoofd-categorie: </td> <td> <select id="manhoofd">
<option>HEREN</option>
<option id="mankleding">KLEDING</option>
<option id="manschoen">SCHOENEN</option>
<option id="manaccessoires">ACCESSOIRES</option>
</select>
</td>
</tr>
<tr>
<td> Artikel sub-categorie: </td> <td id="subcategorie"> <select id="subkledingheren">
<option>HEREN-KLEDING</option>
<option>Broeken & Jeans</option>
<option>Jassen</option>
<option>Sweaters & Hoodies</option>
<option>Zwemkleding</option>
</select>
<select id="subschoenenheren">
<option>HEREN-SCHOENEN</option>
<option>Sneakers/Casual</option>
<option>Slippers & Sandalen</option>
<option>Instappers</option>
</select>
<select id="subsaccessoiresheren">
<option>HEREN-ACCESSOIRES</option>
<option>Horloges</option>
<option>Brillen & Zonnebrillen</option>
<option>Stropdassen</option>
</select>
</td>
</tr>
您是否嘗試過所有其他瀏覽器,Chrome,IE,Opera ...調試?控制檯說什麼?當然你正在加載文檔準備好? – elclanrs 2012-07-14 00:58:00