How to select class only in same div
Hello
I can select radio val, but how to copy price to new div.
Thanks so much
- <script>
$(document).ready(function () {
$('.selectitem').bind('change click keyup', function() {
$('.myselected').text($(this).val());
$('.myprice').text($('.price').text());
});
});
</script>
- <h2 style="margin-bottom:20px">Product</h2>
<div class="box">
<input name="selectitem" class="selectitem" value="Item A" type="radio">
Item A : <span class="price"> 5 </span> USD
</div>
<div class="box">
<input name="selectitem" class="selectitem" value="Item B" type="radio">
Item B : <span class="price"> 2 </span> USD
</div>
<div class="box">
<input name="selectitem" class="selectitem" value="Item C" type="radio">
Item C : <span class="price"> 8 </span> USD
</div>
<hr>
My Selected : <span class="myselected"></span>
<br>
My Price : <span class="myprice"></span>