I'm trying to take what someone types into one text input and copy it into a second one. I am able to accomplish this, my problem is with the each function. These two input fields (side by side) repeat a couple times in a row and I need to have different values per row. You can see my issue in the fiddle.
Here's some example code:
HTML:
<div class="media">
<div class="row">
<div class="input-holder-one">
<input type="text">
</div>
<div class="input-holder-two">
<input type="text">
</div>
</div>
</div>
<div class="media">
<div class="row">
<div class="input-holder-one">
<input type="text">
</div>
<div class="input-holder-two">
<input type="text">
</div>
</div>
</div>
jQuery
jQuery(function ($) {
$('.media .row').each(function(){
$(this).find('.input-holder-one input').on('keyup', function(){
$('.input-holder-two input').val($('.input-holder-one input').val());
});
});
});
Here's a jsfiddle: