Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     <script>
  2.         (function($){
  3.             $(function(){
  4.  
  5.                 $(document).on('click','.offer,.last-offer', function(){
  6.                     $('.offer,.last-offer').removeClass('active');
  7.                     $(this).addClass('active');
  8. //                    var icon = $(this).find('img')[0].outerHTML;
  9. //                    var lastIcon = $('.last-offer').find('img')[0].outerHTML;
  10.                     var offerValue =$(this).find('input').val();
  11.  
  12.  
  13. //                    $('#choice').show(icon);
  14.                     $('#final').html(offerValue);
  15.  
  16.  
  17.                     if($('#last-offer').is(':checked')){
  18.                         $('#choice').html(lastIcon);
  19.                         var lastOfferValue = $('#last-offer').val();
  20.                         $('#final').html(lastOfferValue);}
  21.                     else{
  22.  
  23.                         $('.last-offer').removeClass('active');
  24.                         lastIcon=" ";
  25.                         lastOfferValue=" ";
  26.                         $('#choice').html(lastIcon);
  27.                         $('#final').html(lastOfferValue);
  28.                     };
  29.  
  30.                     if($('.offer').hasClass('active')){
  31. //                        $('#choice').html(icon);
  32.                         $('#final').html(offerValue);
  33.                     };
  34.  
  35.                     if(($('.offer').hasClass('active'))&&($('#last-offer').is(':checked'))){
  36. //                        $('#choice').html(icon+'&'+lastIcon);
  37.                         var sum = (parseInt(offerValue)+parseInt(lastOfferValue));
  38.                         $('#final').html(sum);
  39.  
  40.                     };
  41.  
  42.  
  43.                     /*
  44.                      $('#choice').html(icon);
  45.                      var sum = offerValue + lastOfferValue;
  46.                      $('#final').html(sum);
  47.                      */
  48.  
  49.  
  50.  
  51.                     /*
  52.                      if($("input[name='offer']").is(':checked')){
  53.                      $('#choice').html(icon);
  54.                      };
  55.                      if(($('#last-offer').is(':checked'))&&($("input[name='offer']").is(':checked'))){
  56.                      $('#choice').html(icon+'&'+lastIcon);
  57.                      };
  58.                      if(($('#last-offer').is(':checked'))&&(!$("input[name='offer']").is(':checked'))){
  59.                      $('#choice').html(lastIcon);
  60.                      };
  61.  
  62.  
  63.                      */
  64.  
  65.                 });
  66.  
  67.  
  68.  
  69.             });
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.         })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement