0
I’m having a hard time handling a list by javascript would like a tip or help if possible
that’s the mistake I’m making
Array [ "AC.FIXED" ] registration:280:4
Referenceerror: $ is not defined[Learn More] registration:282:4
Empty string passed to getElementById(). register
Empty string passed to getElementById(). register
and my javascript
<script>
listaProjeto = "${usuarioBean.listaNomeProjeto}";
listaProjeto = listaProjeto.replace("[", "")
listaProjeto = listaProjeto.replace("]", "")
var teste = listaProjeto.split(",");
console.log(teste)
$.each(teste, function(index, value) {
alert(index + ": " + value);
});
</script>
from what I read on it says my jQuery isn’t installed, but it’s all right.
Where’s the part where you reference jQuery on the page?
– Jéf Bueno
by the code Voce posted the error is not happening in this part, because there is no getElementByID in your code but the error comes from there (and also I think jQuery was not referenced)
– leofontes
here is the above code with the jQuery reference <script type="text/javascript" src="/Resources/js/jQuery-2.2.0.min. js"></script> <script> listProject = "${usuarioBean.listaNomeProject}"; listProjeto = listProjeto.replace("[", "") listProjeto = listProjeto.replace("]", ") var test = listProjeto.split(","); console.log(test) $. each(test, Function(index, value) { Alert(index + ": " + value); }); </script>
– Wesley Santos
if jquery is installed correctly you may not have referenced it in your HTML for example, something like this
<script src="jquery-1.10.1.min.js" type="text/javascript" ></script>
– Vinicius
because it is expensive more I referenciei it in the normal page
– Wesley Santos