tags:

views:

34

answers:

2

Hello i have this code that works perfect in Firefox but in IE 8 doesn't work and doesn't give me any error ?!

   $(".shp_div").change(function () {
      var str = "";
      $("select option:selected").each(function () {
           var countprod =parseInt($("#countprod").val());
            var str2 = $(this).val();
            str2_array = str2.split('|');
            var cost = parseInt(str2_array[0]);
            var cost_extra = parseInt(str2_array[1]);
            if ($("#countprod").val()>1) {
            str = parseInt(((countprod-1)*cost_extra) + cost);
            } else{
            str = cost;
          }});
      $(".csq_item2").text(str);
       var total =parseInt($("#subtotal").val());
      var shipping=parseInt(str + total);
      $(".price_total").text(shipping);
    })
    .change();
A: 

You could press F12 to open the IE developer console and then run the IE8 JavaScript debugger and then you can step through and see what is happening.

Dan Diplo
A: 

Since I don't have the entire picture, i am guessing you are not getting the value of the selected option, So here is the code. Its commented with "Try using this":

$(".shp_div").change(function () {
      var str = "";
      $("select option:selected").each(function () {
           var countprod =parseInt($("#countprod").val());
            // var str2 = $(this).val();
            var str2 = $(this).attr("value");  // Try using this!
            str2_array = str2.split('|');
            var cost = parseInt(str2_array[0]);
            var cost_extra = parseInt(str2_array[1]);
            if ($("#countprod").val()>1) {
            str = parseInt(((countprod-1)*cost_extra) + cost);
            } else{
            str = cost;
          }});
      $(".csq_item2").text(str);
       var total =parseInt($("#subtotal").val());
      var shipping=parseInt(str + total);
      $(".price_total").text(shipping);
    })
    .change();
naikus
thank you for answer .. i tried your solution but no success .. in Firefox still work in IE no chance.In order to get "full picture" please go at : http://poshsunglasses.net/21-Bottega_Veneta-B.V.88.html and add to cart the prod and then in the cart page try to select the Shipping country .. there the problem appear in IE .thank you
Teodor