jQuery/Materialize: Changing select option back to disabled select on clear
You have to reset both select
element and material select:
var select = $('select');
$(".btn").click(function(){
$("form input").val("");
select.prop('selectedIndex', 0); //Sets the first option as selected
select.material_select(); //Update material select
});
select.material_select();
You have to select that select the input to the none value and then re render the component:
$(".btn").click(function(){
$("form input").val("");
$("select").val("None");
$('select').material_select();
});
$('select').material_select();
Here is a fiddle with it https://jsfiddle.net/xjqgeuhp/