Thursday, 8 June 2017

blur jQuery

jQuery(".qty").blur(function(){
  var currency_sy= jQuery('#currency_syamble').val();
  var qty_val = jQuery(this).val();
  var item_price = parseFloat(jQuery(this).attr('data-price'));
  var currency_sy = jQuery(this).attr('data-currency');
  var totalItemPrice = qty_val*item_price;
  var total_item = parseFloat(totalItemPrice).toFixed(2);
  jQuery(this).parent().find('.item_total_price').html(currency_sy+total_item);
  var Totalprice=0;
  jQuery(".qty-wrapper").each(function(index) {
      var eachQty = jQuery(this).find('.qty').val();
      var eachprice = jQuery(this).find('.qty').attr('data-price');
      Totalprice = Totalprice + (eachQty*eachprice);
     
  });
  var total = parseFloat(Totalprice).toFixed(2);

 
  jQuery("#total_price").html(currency_sy+total);
});

No comments:

Post a Comment