0
我有一個html的字符串,我需要把它放在一個輸入select中,但是它的輸入選擇範圍已經超出範圍......我想,看看我正在構建的選項變量?它需要在下一次選擇的任何課後.product ...請告知。如何用JQuery中的變量遍歷範圍?
$(".product").change(function(){
//get selected option of the select that changed
var selected = $(this).val();
//then create the url to reference the value of the selected option (product id)
var url = "/order/getpricing/" + selected;
//remove all options from that nearby select statement
$(this).next('select').children().remove();
var pricelist = $(this).next('select');
$.getJSON(url, function(data, pricelist){
var options = '';
for(n = 0; n < data.length; n++){
options += '<option value="' + data[n].volumeID + '">' + explainPricing(data, n) + '</option>';
//setMeGlobal(options, "options");
}
$("#"+pricelist).html(options);
//TODO NEXT: SOMEHOW ADD OPTIONS TO THE SELECT!
});
$(this).next('select').html = options;
});