I tried to dynamically create a div with a select input inside but it turns out that there is an empty div with noting.
As you can see, $eduRow is a div that used as a container. Trying to solve it in many ways but still not working(always came up with an empty div).
I have a clicking button that will dynamically create these select stuff after click.
Here is the function that's written inside document ready function.
$("#addMoreEdu").on('click', function() {
var $eduRow = $("#edu-row");
var select = $('<select />', {
'class': 'selectoption'
});
$(select).append($('<option value="" disabled selected>Degree option</option>'));
$(select).append($('<option value="1">High School</option>'))
$(select).append($('<option value="2">College</option>'))
$(select).append($('<option value="3">Bachelors degree</option>'))
var div = $('<div />', {
'class': 'input-field col s12 m4 l4'
});
$(div).append(select)
$eduRow.append(div);
$eduRow.append('<div class="input-field col s12 m4 l8"><span class="fieldLabel"> Institutes Name</span><input placeholder="Institutes Name" id="IntsName" type="text" /></div>');
});
Another weird thing is that the second append works fine. I think there must be some problem with select :\ Any ideas?
NOTE: I have my code up herecodepen if you can take a look at Educational Background section.
disabledselected