Semantic-UI Dynamic Dropdown-open source projects Semantic-Org/Semantic-UI
Got a problem with semantic-ui dropdown.
I’ve been using Semantic-Ui, and wanted to change the dropdown item dynamically. That is, when i choose the value from the first dropdown, the second dropdown’s item will change. But the thing is, when the items are changed, the second dropdown cannot be chose, the value won’t change. The dropdown won’t collapse back.
The HTML
The First Dropdown
Choose..
Car
Tank
Plane
Second Dropdown
Choose..
Choose..
……………………..
The jQuery
$("#programmetype").dropdown({
onChange: function (val) {
if (val == "val1")
{
$('#servicetype .menu').html(
'Saloon' +
'Truck'
);
};
if (val == "val2")
{
$('#servicetype .menu').html(
'Abraham' +
'Leopard' +
);
};
if (val == "val3")
{
$('#servicetype .menu').html(
'Jet' +
'Bomber' +
);
};
}
});