Web Develop Forum: Update Price On Click - Web Develop Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Update Price On Click Rate Topic: -----

#1 User is offline   paulOr Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 20
  • Joined: 23-October 08
  • Location:Edinburgh, Scotland

Posted 08 April 2009 - 10:11 AM

This little bit of code updates the price of an item when different things are selected, ie, Credit/Debit Cards

CODE
function update_price(){
    var price_orig = $('#price_orig').html();
    var price_con = $('#price_con').html();
    var price_vis = $('#price_vis').html();
    var price_vis_con = $('#price_vis_con').html();
    if($('#conservation:checkbox').is(':checked')){
        if($('#card').val() == 'Mastercard' || $('#card').val() == 'Visa'){
            $('#total_price').html(price_vis_con);
            $('#total_again').html(price_vis_con);
            $('#total_deposit').html(Math.round((price_vis_con / 4)*100)/100);
        }else{
            $('#total_price').html(price_con);
            $('#total_again').html(price_con);
            $('#total_deposit').html(Math.round((price_con / 4)*100)/100);
        }
    }else{
        if($('#card').val() == 'Mastercard' || $('#card').val() == 'Visa'){
            $('#total_price').html(price_vis);
            $('#total_again').html(price_vis);
            $('#total_deposit').html(Math.round((price_vis / 4)*100)/100);
        }else{
            $('#total_price').html(price_orig);
            $('#total_again').html(price_orig);
            $('#total_deposit').html(Math.round((price_orig / 4)*100)/100);
        }    
    }
}


Its basically changing the price is you select mastercard or visa, adding 2% to the total and it also devides by 4 to get 25% of the total.

It works, and it works great, however ONLY on FF, in IE you need to do the selection, then click on the page to get it to change the price, can anyone see WHY it doesnt update on its own in IE?

Much fanks in advance.!
0

#2 User is offline   Sam Granger Icon

  • Administrator
  • PipPipPip
  • Group: Root Admin
  • Posts: 431
  • Joined: 22-October 08
  • Gender:Male

Posted 10 April 2009 - 08:41 PM

Do you have a live example?
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users