以前の選択に基づいてドロップダウン リストを表示しようとしています。それは動作しません。リストされているすべての値が表示されます。ticket_fields_21114185 は、[デスクトップ、Web ブラウザー] のような値を持つ最初のドロップダウン リストです。ticket_fields_21108325 は、他のすべての値がリストされている 2 番目のドロップダウン リストです。
$j(document).ready(function() {
var ren
var dtop = ['windows_7'];
var webrow= ['all','chrome','ie'];
//this builds the dropdown list
Buildoptions = {
selected: function(value, name){
return '<option value="'+value+'" selected="selected">'+name+'</option>';
},
notselected: function(value, name){
return '<option value="'+value+'">'+name+'</option>';
},
clear: function(){
return '<option value=""></option>';
}
}
//goes through the selected array and builds the options
var makeSelection = function(theField, theArray) {
for ( x = 0; x < theArray.length; x++ ) {
console.log('makeing select ' + theArray)
if (x == 0)
$j(''+ theField +'').append(Buildoptions.notselected(theArray[x], theArray[x]));
}
}
$j('select#ticket_fields_21114185').change( function(){
ren=$j('select#ticket_fields_21114185 option:selected').val();
if(ren=='desktop'){
makeSelection('select#ticket_fields_21108325',dtop);
}
else
makeSelection('select#ticket_fields_21108325',webrow)
});
});