Я хочу заполнить второе поле выбора соответствующими значениями в зависимости от того, что было выбрано в первом поле выбора.
Это то, что я делал до сих пор, но это не работает:
HTML:
Creator:
Hello
oiasfn
Trip Title:
JavaScript/jQuery:
$(document).ready(function(){
updateform();
});
function updateform(){
document.getElementById("creator").onchange = populatetitle;
}
function populatetitle(){
var select = document.getElementById("creator");
if(select.options[select.selectedIndex].value = "hello"){
select.options.add(new Option('Byebye', 'Bye'));
}
}
Подробнее здесь: https://stackoverflow.com/questions/176 ... ther-selec
Мобильная версия