Magento 中的这个 jQuery 代码基本上是一个三步汽车零件查找器,首先用户选择制造年份,然后选择制造公司,然后是型号以获取汽车零件列表。该代码仅适用于 IE 和 Firefox,但不适用于 Chrome。我找不到我的错误。期待解决方案
$j = jQuery.noConflict();
$j(document).ready(function(){
for(st1 = 1; st1 <= 1000; st1++) {
//filling options of select.opt1
//works fine
}
$j("#shop-by-vehicle select.opt1 option").click(function() {
$j("#shop-by-vehicle select.opt2 option").remove();
$j("#shop-by-vehicle select.opt3 option").remove();
for(st2 = 1; st2 <= 1000; st2++) {
//used to fill options of select.opt2
}
$j("#shop-by-vehicle select.opt2 option").click(function() {
$j("#shop-by-vehicle select.opt3 option").remove();
for(st3 = 1; st3 <= 10000; st3++) {
//used to fill options of select.opt3
}
$j("#shop-by-vehicle select.opt3 option").click(function() {
// do something when select.opt3 options are clicked
});
});
});
}); //end jquery function
代码
<div id="shop-by-vehicle">
<div class="steps">
<select class="opt1 opt"></select>
</div>
<div class="steps">
<select class="opt2 opt"></select>
</div>
<div class="steps">
<select class="opt3 opt"></select>
</div>
</div>