проставить значения value
Есть такой код.
<div class="row_item"> <h1>first item</h1> <img src="img/12803143.jpg" alt=""> <span></span> <input placeholder="text here " type="text"> </div> <div class="row_item"> <h1>second item</h1> <img src="img/12803143.jpg" alt=""> <span></span> <input placeholder="text here " type="text"> </div> <div class="row_item"> <h1>third item</h1> <img src="img/12803143.jpg" alt=""> <span></span> <input placeholder="text here " type="text"> </div> Как каждому inputu проставить value, равное h1 из того же блока row_item? если так $('.row_item input').each(function(){ $(this).attr('value', $('h1').html()); }); то один h1 ставит всем inputам |
this.value = $(this).prevAll('h1').text(); |
спасибо))
|
Часовой пояс GMT +3, время: 18:57. |