I want to change materialize select box value by jquery.
I am using $('#myselect').val('1');
on onchange
event of other select box but it not works.
$("#select1").change(function() {
$('#myselect').val('1');
});
I want to change materialize select box value by jquery.
I am using $('#myselect').val('1');
on onchange
event of other select box but it not works.
$("#select1").change(function() {
$('#myselect').val('1');
});
As suggested by @logikal, you have got to re-Initialize
For a new materialize 1.0.0 use
.select()
instead of.material_select()
Solution without re-initialization.
Then just use
In 2018 (
Materialize v1.0.0-rc.2
), first you have to set your option programmatically:And then re-initialise the
select
input with:Hope it helps!