javascript - Two text inputs, one submit button. When submitting the form, value of first input appears in the other input with jQuery or JS? -


<form action="" id="form2">   <div>     <input type="text" id="third">     <input type="submit" id="submit_form">   </div>  </form> <div>   <input type="text" id="fourth"> </div> 

two text inputs, 1 submit button. when submitting form, value of first input appears in other input in jquery or js?

after submitting form input value displayed in input field.

how can make work using javascript or jquery only?

use button instead of submit input type, here go:

$('#submit_form').click(function(){          $('#fourth').val($('#third').val());    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <form action="" id="form2">          <div>              <input type="text" id="third">              <input type="button" id="submit_form" value="submit">          </div>        </form>      <div>          <input type="text" id="fourth">      </div>


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -