Topic: material select / dropdown issue
Brecht Richard pro asked 8 years ago
$("#periode").change(function () {
$.ajax({
type: 'POST',
url: '@Url.Action("GetKampenVanPeriode")',
dataType: 'json',
data: { id: $("#periode").val() },
success: function (kampen) {
$("#kampen").empty();
$.each(kampen, function (i, kamp) {
$("#kampen").append('<option value="'
+ kamp.Value + '">' +
kamp.Text + '</option>');
});
},
error: function (ex) {
alert('Error!: ' + ex);
}
});
return false;
"#periode" is the first dropdown. When the selection changes, the "#kampen" options are filled .
Quite straight forward, but don't understand why it isn't working with the material select.
Anyone that could help? Or I'm I just stuck with the browser-default?
Ian Morris free answered 6 years ago
$(document).ready()
$.get("views/funcs/get-cust-list.php", function(data){ var o = $.parseJSON(data); $.each(o.custLookup, function(custName, arr){ var val = parseInt(arr.id); var name = custName; var activeCheck; $("#cust_id").append('<option value="'+val+'" '+activeCheck+'>'+name+'</option>'); }); $('.mdb-select').material_select(); }); <select class="mdb-select colorful-select dropdown-primary" id="cust_id"> <option value="0" selected="" hidden="">Select A Client: </option> </select>
Sebastian Kaczmarek staff commented 6 years ago
Indeed, there was a bug in the old 4.5.7 version. In 4.5.9 version we have rewritten the Material Select from scratch and all the issues have been addressed. However, in the 4.5.9 version, there is a nasty bug which has been fixed in the latest 4.5.10 version. So my suggestion is to use the latest MDB 4.5.10ijabit free answered 8 years ago
Brecht Richard pro answered 8 years ago
Michal Szymanski staff answered 8 years ago
$('select').material_select('destroy');
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No