1
I’m trying to make a project here using Materialize, but the field select is not appearing.
This one is HTML
<div class="input-field col s4">
<select>
<option value="" disabled selected>Escolha uma opção</option>
<option value="1">Código</option>
<option value="2">Nome</option>
<option value="3">Email</option>
</select>
<label for="search">Filtrar</label>
</div>
This one is Javascript:
$(document).ready(function() {
$('select').formSelect();});
It’s getting like this in the View
Who wants to know more about has a documentation of Materialize: https://materializecss.com/select.html
This is the console error
Any error in console?
– Netinho Santos
Vitor I tested the Selects here in the two versions of Materialize and gave no error in the Console, the JS is right. If you have an error it must be because you have something else in your Script that is accusing the error. Until pq I used the official documentation, and it does not include anything else in the script. So the error is something unrelated to the Select Script.. You have to see what you did to JS
– hugocsl
He’s showing me indefinite $ error
– Victor Gabriel
It is I noticed, but it is not related to the Select script, this error is elsewhere in your JS, you must have put something else there in this script. I advise you to open another question and put your full JS to see what might be... So much so that if you test only with the code I posted in a new file you will see that there is no error in the console.
– hugocsl
now gave another error: Uncaught Referenceerror: Materialize is not defined
– Victor Gabriel
This is the script I used
$('select').formSelect();
Note that the word "Materialize" does not appear in it... Your error is not with Select. It is in another part of the script. As and I told you recommend open another question, put your full Javascript and some user will be able to help you better.– hugocsl
Okay then, I’ll be opening another question, thank you hugocsl
– Victor Gabriel
@hugocsl, if you are interested, please enter the other question https://answall.com/questions/302516/erro-uncaught-referenceerror-materialize-is-not-defined
– Victor Gabriel