I used this simple trick to display the name of a person after he sends the form data via Ajax and I needed a different response(not from Ajax), so, I set the response message to display:none via css and get the name or other informations in real time… when the form is submitted… the div becomes visible and shows the result… like Thank you {Name} for sending us etc. …
1 2 3 |
$('#name_x').keyup(function () { $('#get_name').text($(this).val()); }); |
1 2 3 4 5 6 7 |
<pre class="wp-block-code"><code>&lt;form&gt; <form<input type="text" name="name" id="name_x" size="44" placeholder="Type here to see real time result in div..." style="padding:12px;border-radius:4px;border:1px solid grey" > <br><br> <div id="get_name"></div> </form> |
You can see a live demo here.