我在这个项目上工作,有8个选择选项。如果用户选择此一个选择区域下的选项,则填充并构建指向商店前端的链接。一切都很好,所有选择都有适当的价值,链接建立。但是,它没有去链接(smeh)。这是我的jQuery代码。我很确定它在我建模的方式中。
$('#tf-bundles input[type="submit"]').click(function() {
if ($('#tf-key-sel .quantity').val() == "0" && $('#tf-key-sel .padType').val == "0") {
} else {
tfkeyboardqua = $('#tf-key-sel .quantity').val();
tfkeyboardpad = $('#tf-key-sel .padType').val();
keyboardcombine = 'ProductCode=' + tfkeyboardpad + '&Qty.' + tfkeyboardpad + '=' + tfkeyboardqua;
};
if ($('#tf-case-sel .quantity').val() == "0" && $('#tf-case-sel .padType').val == "0" && $('#tf-case-sel .padColor').val == "0") {
} else {
tfcasesqua = $('#tf-case-sel .quantity').val();
tfcasescolor = $('#tf-case-sel .padColor').val();
tfcasespad = $('#tf-case-sel .padType').val();
casecombine = 'ProductCode=' + tfcasespad + '-' + tfcasescolor + '&Qty.' + tfcasespad + '=' + tfcasesqua;
};
if ($('#tf-case-sel .quantity').val() == "0" && $('#tf-case-sel .padType').val == "0" && $('#tf-case-sel .padColor').val == "0") {
} else {
tfcomboqua = $('#tf-key-case-sel .quantity').val();
tfcombopad = $('#tf-key-case-sel .padColor').val();
tfcombocolor = $('#tf-key-case-sel .padType').val();
combocombine = 'ProductCode=' + tfkeyboardpad + '-' + tfcombocolor + '&Qty.' + tfkeyboardpad + '=' + tfkeyboardqua;
};
if (keyboardcombine != "" && casecombine == "" && combocombine == "") {
window.location.href = solidLink + keyboardcombine;
}
});
这是一组HTML
<ul class="selection">
<li>
Quantity
<select class="quantity">
<option value="0">How Many</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</li>
<li class="question">
<img src="images/circle-q.png" alt="q" class="question ">Select Your iPad
<select class="padType">
<option value="0">Choose your iPad</option>
<option value="TF-8483-BK">iPad 1</option>
<option value="TF-8483-BK">iPad 2</option>
<option value="TF-8483-BK">iPad 3</option>
<option value="TF-8483-BK">iPad 4</option>
<option value="TF-2731-BK">iPad mini</option>
<option value="TF-2772-BK">iPad Air</option>
</select>
</li>
<li>
Select Color
<select class="padColor">
<option value="0">Choose your color</option>
<option value="BK">Black</option>
<option value="BL">Blue</option>
<option value="GY">Light Grey</option>
<option value="RD">Red</option>
</select>
</li>
</ul>
我相信我的jQuery部分问题如下:
if (keyboardcombine != "" && casecombine == "" && combocombine == "") {
window.location.href = solidLink+keyboardcombine;
}