1
Good morning. My problem is that I can’t or don’t know how to get the values of a Select Múltiple of Materialize V 0.100.2
, if anyone can explain or help me, please, I’ll take it, but it won’t give me back anything !!:
$(document).ready(() => {
$("select").material_select();
$(".jsBtnSaveValuesNotificationsShedule").on("click", () => {
console.log($(".jsSelectedSchedule").val());
});
});
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<div class="row">
<div class="input-field col s6">
<select class="jsSelectedSchedule" name="jsNameSelectedSchedule" multiple>
<option value="" selected disabled>Seleccione</option>
<option value="1">Opcion 1</option>
<option value="2">Opción 2</option>
</select>
<label>Selecciona el tipo de horario</label>
</div>
</div>
<div class="row">
<div class="col m4 offset-m4 s4 offset-s4">
<a class="btn waves-effect waves-light jsBtnSaveValuesNotificationsShedule">Obter</a>
</div>
</div>
Thanks Leandrade, it works. And you just give me an idea on how to go through the options without a each () not to have a long code, I will try to do and post the solution.
– Luis Fernando
Nice that it worked.
– LeAndrade