Having a little trouble appending options in a materialize select for my project. Can someone take a look at my code snippet below and provide some guidance on what changes I should make? Thanks!
$(document).ready(function() {
$(".condition").click(function() {
$('.shw').append($('.hidden').clone().removeClass("hidden"));
});
});
$(document).ready(function() {
$(".delete").click(function() {
$('.hidden').remove();
});
});
.hidden {
display: none
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<div class="hidden">
<fieldset>
<table class='addRuleHolder'>
<tr>
<td class="label-col">
<label>Sensor:</label>
</td>
<td>
<select>
<option value="1">S1</option>
<option value="2">S2</option>
</select>
</td>
</tr>
<tr>
<td class="label-col">
<label>Threshold Value:</label>
</td>
<td>
<input type="text">
</td>
</tr>
</table>
<button class="waves-effect waves-light btn delete" >delete</button>
</fieldset>
</div>
<div style="margin-top: 20px; float:right;padding-right:15px">
<button class="waves-effect waves-light btn condition" value="Add">condition</button>
</div>
<br style="clear:both"/>
<div class="shw"></div>
Any help would be greatly appreciated, and no worries about your English! Thank you.