Skip to content Skip to sidebar Skip to footer

Jquery Copy Input Field To Another Input Outside Div

I have some jquery I have been working to debug. I have a search field that when I enter the text into the input field at the top of the page, I am expecting the value of the first

Solution 1:

You can use something like this. This will mirror any change on an input with the data-mirror attribute to any other input with data-mirror. Then you can bind as many as you like.

$('[data-mirror]').on('change keyup paste',function(){
  $('[data-mirror]').val(this.value);
});
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><inputtype="text"data-mirror><br/><inputtype="text"data-mirror><br/><div><inputtype="text"data-mirror></div>

Post a Comment for "Jquery Copy Input Field To Another Input Outside Div"