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 is not getting reflected.
Here is the code snippet:
$(document).ready(function() {
$("#programmetype").dropdown({
onChange: function() {
$('#servicetype').html(
'<div class="ui selection dropdown select-
language ">'+'<div class="
text ">Choose..</div>'+'<i class="
dropdown icon "></i>'+' <div class="
menu ">'+
'<div class="item" data-value="acp">ACP</div>' +
'<div class="item" data-
value = "art" > ART < /div>'+'</div > '+' < /div>'
);
$('#servicetype').dropdown();
}
});
});
<script src="https://code.jquery.com/jquery-3.1.1.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.js"></script>
<div id="programmetype" class="ui selection dropdown select-
language">
<input type="hidden" name="programmetype">
<div class="text">Choose..</div>
<i class="dropdown icon"></i>
<div class="menu">
<div class="item" data-value="val1">Car</div>
<div class="item" data-value="val2">Tank</div>
<div class="item" data-value="val3">Plane</div>
</div>
</div>
<div id="servicetype"></div>
.html()method, your strings are not properly concatenated. check there and fix the inner content syntax - Towkir