Calculate price according to checboxes checked jquery

$(document).ready(function(){
var calcu;
$(“#GigTitle”).change(function(){
var val= $(“#GigTitle”).val();
var a=Number(val)+Number(1);
var calcu = a*6;
$(“#euroaa”).html(calcu);
$(“#checkoutrate”).html(calcu);
$(“input:checkbox”).click(function(event) {
var total = 0;
$(“input:checked”).each(function() {
total += parseInt($(this).val());
});

if (total == 0) {
$(“#euroaa”).html(calcu);
$(“#checkoutrate”).html(calcu);
}
else {
total= parseInt(total)+parseInt(calcu);
$(“#euroaa”).html(total);
$(“#checkoutrate”).html(total);
}
});
});

});

and html is

Form->input(‘quantity’,array(‘id’=>’GigTitle’,’options’=>array(range(1,20)))); ?>
Form->input(‘fast’,array(‘type’=>’checkbox’,’value’=>’20’,’id’=>’fast’,’label’=>’I Will Provide Order within 4 days for extra €20 ‘)); ?>
Form->input(‘fast1’,array(‘type’=>’checkbox’,’value’=>’40’,’id’=>’fast1′,’label’=>’I Will Provide Order within 3 days for extra €40 ‘)); ?>
Form->input(‘fast2’,array(‘type’=>’checkbox’,’value’=>’60’,’id’=>’fast2′,’label’=>’I Will Provide Order within 2 days for extra €60 ‘)); ?>
Form->input(‘fast3’,array(‘type’=>’checkbox’,’value’=>’120′,’id’=>’fast2′,’label’=>’I Will Provide Order within 2 days for extra €120 ‘)); ?>
<a href="webroot;?>users/buy”>Order Now (€6)
<a href="webroot;?>users/buy”>Order Now (€6)

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s