javascript - Jquery HTML Checkbox and PHP iteration not in FOREACH area -
edit have checkbox iterates 4 times. when checkbox clicked, value totaled on sidebar. sidebar not in foreach area - separate , takes values stored in script , displays totals.
i need figure out how grab name of service , individual price that's within block of text each checkbox, i'm not having luck doing it. how can bind name of service checkbox , display on sidebar when checkbox checked? same service price.
i using bind-click code:
$('input[id^=cknow_]').each(function(){ $(this).bind('click',function(){ if($(this).prop('checked')) {
which ties into:
<div id="product_<?php echo $i;?>" name="product_<?php echo $i;?>"> <?php echo $service->product; ?> <input id="hsprice_<?php echo $i;?>" name="hsprice_<?php echo $i;?>" type="hidden" value="<?php echo floatval($service->price+$service->travel);?>"> </input> <label class="addremove">add/remove <input type="checkbox" class="hideme" id="cknow_<?php echo $i;?>" name="cknow[<?php echo $i;?>]"></input> </label> </div>
on right sidebar i'm calling hidden fields using check-bind fucntion , works fine. need add service name , individual service price sidebar.
how can this?
edit
i've tried adding bind-click event:
var service = '#product_'+$(this).attr("id").split("_"); $('#lblservicename').append($('service').attr('id'));
and called in sidebar:
<p class="alignleft" id="lblservicename"></p>
but didn't work. doing wrong?
Comments
Post a Comment