Hello! It's the following, in my form, I'm trying to get the value entered by the user in the input as follows:
// jQuery
function teste() {
var nome = $("#nome").val();
alert(nome);
}
// HTML
<form method="post" action="#">
<div class="field half first">
<label for="nome">Nome</label>
<input type="text" name="nome" id="nome">
</div>
<div class="field half">
<label for="sobrenome">Sobrenome</label>
<input type="text" name="sobrenome" id="sobrenome">
</div></form>
<button onClick="teste()">Teste</button>
But it does not return any value, it generates a blank alert () regardless of what the user has typed. Does anyone know what can it be? If it's useful, I'm using Codeigniter