I have a form that is created from an event trigger (click). I need to access the values of the inputs to save them in the localStorage but I can not in any way. Below is the code.
``` $('.container-cards').on('click','.btn-search', function(){
$('#cards-2').prepend(`
<div id="container-form">
<span>Ingrese sus datos y nos comunicaremos a la brevedad</span>
<form id="prom-form">
<input type="text" id="nombre name="nombre" placeholder="Ingrese su
nombre y apellido">
<input type="email" id="email" name="email"
placeholder="[email protected]">
<input id="enviar" class="btn-danger" type="submit" value="enviar">
</form>
</div>
`)
$('#cards-2').show()
}) ```
Well friend, first of all, you must close the quotes of the id for your input name. Then to capture the value of the inputs with Jquery you use:
For your case, if you already have the input defined you can capture the values like this (I'm assuming you add the div correctly, you just have to adapt it to your click event trigger). Stay tuned.