S
S
Sergey2018-01-31 02:11:46
JavaScript
Sergey, 2018-01-31 02:11:46

How to copy input value from one input to another input?

So the value is entered only in p

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>

<input type="text" value="some text"/>
 <p></p>
<script>
   $("input").keyup(function () {
     var value = $(this).val();
     $("p").text(value);
   }).keyup();
</script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yevhenii K, 2018-01-31
@alekskondr

Change field values ​​instead of text

<script>
   $("input").keyup(function () {
     var value = $(this).val();
     $("#second_input").val(value);
   });
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question