Alright?
Can you give me a help related to the selection of text entered by a user on a form? I have tried some solutions that I found here, but they did not work. I've also tried different approaches with pure Javascript, but I was not successful.
The form is inside an Asp.Net MVC view and I need to get the data entered by the user on the page to send to the Controller.
The dispatchDatas () function has the assignment / dispatch information for the controller. Debugging I can see that the function is being called successfully, but the variables that should be with the values entered are "null".
Form:
<p class="text-center">Dados para cadastro: </p>
<form>
<div class="col-md-12 form-group">
<label for="nome">Nome: </label>
<input type="text" class="form-control" id="nome" placeholder="Nome.">
</div>
<div class="col-md-12 form-group">
<label for="email">E-mail: </label>
<input type="email" class="form-control" id="email" placeholder="E-mail.">
</div>
<div class="col-md-12 form-group">
<label for="telefone">Telefone: </label>
<input type="text" class="form-control" id="telefone" placeholder="Número de contato.">
</div>
<div class="col-md-12 form-group">
<button type="submit" class="botaogrande btn btn-primary" onclick="enviarDados()">Cadastrar</button>
</div>
</form>
Attempt to select with jQuery:
var dadosNome = $("#nome").text();
var dadosTelefone = $("#telefone").text();
var dadosEmail = $("#email").text();
Thank you in advance.