我有以下代码根据前面下拉框的选择填充下拉框:
$('#console').on('change', function() {
$('#model').val('selectmodel');
$('#model').change();
})
$('#model').on('change', function() {
$('#repair').val('selectrepair');
$('#repair').change();
})
ps4models = new Array("PS4 (Release Model)", "PS4 Slim", "PS4 Pro");
xboxonemodels = new Array("Xbox One (Release Model)", "Xbox One Slim", "Xbox One Scorpio");
ps3models = new Array("PS3 (Release Model)", "PS3 Slim", "PS3 Super Slim");
xbox360models = new Array("Xbox 360 (Release Model)", "Xbox 360 Slim", "Xbox 360 Super Slim");
wiimodels = new Array("Wii", "Wii U");
othermodels = new Array("Other");
ps4repairs = new Array("test ps4", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps4slimrepairs = new Array("test ps4 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps4prorepairs = new Array("test ps4 p", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xboxonerepairs = new Array("test xb1", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xboxoneslimrepairs = new Array("test xb1 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xboxonescorpiorepairs = new Array("test xbox1 sc", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps3repairs = new Array("test ps3", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps3slimrepairs = new Array("test ps3 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps3superslimrepairs = new Array("test ps3 ss", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xbox360repairs = new Array("test xb360", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xbox360slimrepairs = new Array("test xb360 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xbox360superslimrepairs = new Array("test xb360 ss", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
wiirepairs = new Array("test wii", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
wiiurepairs = new Array("test wiiu", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
otherrepairs = new Array("test other", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
populateSelectModel();
$(function() {
$('#console').change(function() {
populateSelectModel();
});
});
function populateSelectModel() {
console = $('#console').val();
$('#model option[value!="selectmodel"]').remove();
if (console == 'ps4') {
ps4models.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'xboxone') {
xboxonemodels.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'ps3') {
ps3models.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'xbox360') {
xbox360models.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'wii') {
wiimodels.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'other') {
othermodels.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
}
populateSelectRepair();
$(function() {
$('#model').change(function() {
populateSelectRepair();
});
});
function populateSelectRepair() {
model = $('#model').val();
$('#repair option[value!="selectrepair"]').remove();
if (model == 'PS4 (Release Model)') {
ps4repairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS4 Slim') {
ps4slimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS4 Pro') {
ps4prorepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox One (Release Model)') {
xboxonerepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox One Slim') {
xboxoneslimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox One Scorpio') {
xboxonescorpiorepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS3 (Release Model)') {
ps3repairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS3 Slim') {
ps3slimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS3 Super Slim') {
ps3superslimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox 360 (Release Model)') {
xbox360repairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox 360 Slim') {
xbox360slimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox 360 Super Slim') {
xbox360superslimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Wii') {
wiirepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Wii U') {
wiiurepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Other') {
otherrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="console">
<option value="selectconsole">Select My Console</option>
<option value="ps4">PS4</option>
<option value="xboxone">Xbox One</option>
<option value="ps3">PS3</option>
<option value="xbox360">Xbox 360</option>
<option value="wii">Wii and Wii U</option>
<option value="other">Other</option>
</select>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="model">
<option value="selectmodel">Select My Model</option>
</select>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="repair">
<option value="selectrepair">Select My Repair</option>
</select>
<a href="">Get My Quote</a>
&#13;
我希望下拉框后面的链接标记根据第二个和第三个下拉框中的选择转到另一个页面。最好的方法是什么?
对不起,我应该提到我无法编辑当前的网址结构,因为我不想弄乱我的入站链接。所以我只是计划为每个组合提供一行代码。显然不是最佳的,只要它有效。例如
如果型号是&#34; ps4 slim&#34;和维修是&#34; hdmi replacement&#34;,转到xxxxx .htm
如果型号是&#34; ps3&#34;和维修是&#34; ylod&#34;,转到xxxxx .htm
答案 0 :(得分:1)
我将如何做到这一点:
otherrepairs = [
["www.a.com", "test other"],
["b.com", "HDMI port replacement"],
["c.com", "Turns on then turns off"],
["d.com", "Can't insert or eject disc"]
];
if (model == 'Other') {
otherrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t[0]).text(t[1]));
});
}
同时更新:
$(".browse").click(function() {
window.location = $("#repair").val();
});
以上是我如何构建数组以容纳链接。
我只将新结构应用于&#34;其他&#34;为演示而选择的选项。 您将需要复制剩余的代码。
我在链接中添加了一个类,也添加了最后一个下拉列表,以便我可以通过JQuery引用它们并重定向到所需的页面。
答案 1 :(得分:1)
根据所选项目的值,为每个选择更改内置网址提供id="url"
链接
$('#console').on('change', function() {
$('#model').val('selectmodel');
$('#url').attr('href', $(this).val() + '-repair/' + $('#model').val() + '/' + $('#repair').val() + '.html');
$('#model').change();
})
$('#model').on('change', function() {
$('#repair').val('selectrepair');
$('#repair').change();
$('#url').attr('href', $(this).val() + '-repair/' + $('#model').val() + '/' + $('#repair').val() + '.html');
})
$('#repair').on('change', function () {
$('#url').attr('href', $(this).val() + '-repair/' + $('#model').val() + '/' + $('#repair').val() + '.html');
})
ps4models = new Array("PS4 (Release Model)", "PS4 Slim", "PS4 Pro");
xboxonemodels = new Array("Xbox One (Release Model)", "Xbox One Slim", "Xbox One Scorpio");
ps3models = new Array("PS3 (Release Model)", "PS3 Slim", "PS3 Super Slim");
xbox360models = new Array("Xbox 360 (Release Model)", "Xbox 360 Slim", "Xbox 360 Super Slim");
wiimodels = new Array("Wii", "Wii U");
othermodels = new Array("Other");
ps4repairs = new Array("test ps4", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps4slimrepairs = new Array("test ps4 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps4prorepairs = new Array("test ps4 p", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xboxonerepairs = new Array("test xb1", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xboxoneslimrepairs = new Array("test xb1 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xboxonescorpiorepairs = new Array("test xbox1 sc", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps3repairs = new Array("test ps3", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps3slimrepairs = new Array("test ps3 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps3superslimrepairs = new Array("test ps3 ss", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xbox360repairs = new Array("test xb360", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xbox360slimrepairs = new Array("test xb360 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xbox360superslimrepairs = new Array("test xb360 ss", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
wiirepairs = new Array("test wii", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
wiiurepairs = new Array("test wiiu", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
otherrepairs = new Array("test other", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
populateSelectModel();
$(function() {
$('#console').change(function() {
populateSelectModel();
});
});
function populateSelectModel() {
console = $('#console').val();
$('#model option[value!="selectmodel"]').remove();
if (console == 'ps4') {
ps4models.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'xboxone') {
xboxonemodels.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'ps3') {
ps3models.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'xbox360') {
xbox360models.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'wii') {
wiimodels.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'other') {
othermodels.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
}
populateSelectRepair();
$(function() {
$('#model').change(function() {
populateSelectRepair();
});
});
function populateSelectRepair() {
model = $('#model').val();
$('#repair option[value!="selectrepair"]').remove();
if (model == 'PS4 (Release Model)') {
ps4repairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS4 Slim') {
ps4slimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS4 Pro') {
ps4prorepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox One (Release Model)') {
xboxonerepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox One Slim') {
xboxoneslimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox One Scorpio') {
xboxonescorpiorepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS3 (Release Model)') {
ps3repairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS3 Slim') {
ps3slimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS3 Super Slim') {
ps3superslimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox 360 (Release Model)') {
xbox360repairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox 360 Slim') {
xbox360slimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox 360 Super Slim') {
xbox360superslimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Wii') {
wiirepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Wii U') {
wiiurepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Other') {
otherrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="console">
<option value="selectconsole">Select My Console</option>
<option value="ps4">PS4</option>
<option value="xboxone">Xbox One</option>
<option value="ps3">PS3</option>
<option value="xbox360">Xbox 360</option>
<option value="wii">Wii and Wii U</option>
<option value="other">Other</option>
</select>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="model">
<option value="selectmodel">Select My Model</option>
</select>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="repair">
<option value="selectrepair">Select My Repair</option>
</select>
<a href="" id="url">Get My Quote</a>
&#13;
更好的方法是将链接存储在数组中,并比较select中所有值的值,并从那里设置正确的URL。
<强>更新强>
您还可以将URL
部分内容保存在data-*
data- *属性用于存储页面或应用程序专用的自定义数据。
$('#console').on('change', function () {
$('#model').val('selectmodel');
$('#url').attr('href', $(this).find(':selected').data('url') + '/' + $('#model').find(':selected').data('url') + '/' + $('#repair').find(':selected').data('url'));
$('#model').change();
})
$('#model').on('change', function () {
$('#repair').val('selectrepair');
$('#repair').change();
$('#url').attr('href', $('#console').find(':selected').data('url') + '/' + $(this).find(':selected').data('url') + '/' + $('#repair').find(':selected').data('url'));
})
$('#repair').on('change', function () {
$('#url').attr('href', $('#console').find(':selected').data('url') + '/' + $('#model').find(':selected').data('url') + '/' + $(this).find(':selected').data('url'));
})
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="console">
<option value="selectconsole">Select My Console</option>
<option data-url="ps4" value="ps4">PS4</option>
<option data-url="xboxone" value="xboxone">Xbox One</option>
<option data-url="ps3" value="ps3">PS3</option>
<option data-url="xbox360" value="xbox360">Xbox 360</option>
<option data-url="wii" value="wii">Wii and Wii U</option>
<option data-url="other" value="other">Other</option>
</select>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="model">
<option value="selectmodel">Select My Model</option>
<option data-url="ps4-release" value="PS4 (Release Model)">PS4 (Release Model)</option>
<option data-url="ps4-slim" value="PS4 Slim">PS4 Slim</option>
<option data-url="ps4-pro" value="PS4 Pro">PS4 Pro</option>
</select>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="repair">
<option value="selectrepair">Select My Repair</option>
<option data-url="ps4-test.html" value="test ps4">test ps4</option>
<option data-url="hdmi-replacement.html" value="HDMI port replacement">HDMI port replacement</option>
<option data-url="turns-on-off.html" value="Turns on then turns off">Turns on then turns off</option>
<option data-url="cant-insert-disc.html" value="Can't insert or eject disc">Can't insert or eject disc</option>
</select>
<a href="" id="url">Get My Quote</a>
&#13;
答案 2 :(得分:0)
$('#console').on('change', function() {
$('#model').val('selectmodel');
$('#model').change();
})
$('#model').on('change', function() {
$('#repair').val('selectrepair');
$('#repair').change();
})
$('#repair').on('change',function(){
$('#anchor').attr('href','www.demo.com/'+$('#repair').val()+'/'+$('#console').val()+'/'+$('#model').val());
});
ps4models = new Array("PS4 (Release Model)", "PS4 Slim", "PS4 Pro");
xboxonemodels = new Array("Xbox One (Release Model)", "Xbox One Slim", "Xbox One Scorpio");
ps3models = new Array("PS3 (Release Model)", "PS3 Slim", "PS3 Super Slim");
xbox360models = new Array("Xbox 360 (Release Model)", "Xbox 360 Slim", "Xbox 360 Super Slim");
wiimodels = new Array("Wii", "Wii U");
othermodels = new Array("Other");
ps4repairs = new Array("test ps4", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps4slimrepairs = new Array("test ps4 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps4prorepairs = new Array("test ps4 p", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xboxonerepairs = new Array("test xb1", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xboxoneslimrepairs = new Array("test xb1 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xboxonescorpiorepairs = new Array("test xbox1 sc", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps3repairs = new Array("test ps3", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps3slimrepairs = new Array("test ps3 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
ps3superslimrepairs = new Array("test ps3 ss", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xbox360repairs = new Array("test xb360", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xbox360slimrepairs = new Array("test xb360 s", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
xbox360superslimrepairs = new Array("test xb360 ss", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
wiirepairs = new Array("test wii", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
wiiurepairs = new Array("test wiiu", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
otherrepairs = new Array("test other", "HDMI port replacement", "Turns on then turns off", "Can't insert or eject disc");
populateSelectModel();
$(function() {
$('#console').change(function() {
populateSelectModel();
});
});
function populateSelectModel() {
console = $('#console').val();
$('#model option[value!="selectmodel"]').remove();
if (console == 'ps4') {
ps4models.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'xboxone') {
xboxonemodels.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'ps3') {
ps3models.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'xbox360') {
xbox360models.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'wii') {
wiimodels.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
if (console == 'other') {
othermodels.forEach(function(t) {
$('#model').append($('<option>').val(t).text(t));
});
}
}
populateSelectRepair();
$(function() {
$('#model').change(function() {
populateSelectRepair();
});
});
function populateSelectRepair() {
model = $('#model').val();
$('#repair option[value!="selectrepair"]').remove();
if (model == 'PS4 (Release Model)') {
ps4repairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS4 Slim') {
ps4slimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS4 Pro') {
ps4prorepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox One (Release Model)') {
xboxonerepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox One Slim') {
xboxoneslimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox One Scorpio') {
xboxonescorpiorepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS3 (Release Model)') {
ps3repairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS3 Slim') {
ps3slimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'PS3 Super Slim') {
ps3superslimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox 360 (Release Model)') {
xbox360repairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox 360 Slim') {
xbox360slimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Xbox 360 Super Slim') {
xbox360superslimrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Wii') {
wiirepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Wii U') {
wiiurepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
if (model == 'Other') {
otherrepairs.forEach(function(t) {
$('#repair').append($('<option>').val(t).text(t));
});
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="console">
<option value="selectconsole">Select My Console</option>
<option value="ps4">PS4</option>
<option value="xboxone">Xbox One</option>
<option value="ps3">PS3</option>
<option value="xbox360">Xbox 360</option>
<option value="wii">Wii and Wii U</option>
<option value="other">Other</option>
</select>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="model">
<option value="selectmodel">Select My Model</option>
</select>
<select data-minimum-results-for-search="Infinity" class="form-control select-filter" id="repair">
<option value="selectrepair">Select My Repair</option>
</select>
<a href="" id="anchor">Get My Quote</a>
请检查代码
更改完最后一个选择框后。我从所有其他选择中获取值并创建锚点
谢谢你可以帮到你