Advertisement
MartinGeorgiev

Untitled

Mar 17th, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function(){
  2. $('button[value="signMeUp"]').click(function () {
  3.     let price = 0;
  4.     let fund = false;
  5.     let adv = false;
  6.     let app = false;
  7.     let web = false;
  8.     $('input[type=checkbox]').each(function () {
  9.         let sThisVal = (this.checked ? $(this).val() : "");
  10.         if (sThisVal === "js-fundamentals") {
  11.             fund = true;
  12.             $('.courseBody ul').append('<li>JS-Fundamentals</li>')
  13.             price += 170;
  14.         }
  15.         if (sThisVal === "js-advanced") {
  16.             $('.courseBody ul').append('<li>JS-Advanced</li>')
  17.             adv = true;
  18.             if (fund) {
  19.                 price += 162;
  20.             } else {
  21.                 price += 180;
  22.             }
  23.         }
  24.         if (sThisVal === "js-applications") {
  25.             app = true;
  26.             $('.courseBody ul').append('<li>JS-Applications</li>')
  27.             price += 190;
  28.  
  29.             if(fund&&adv){
  30.                 price*=0.94;
  31.             }
  32.         }
  33.         if (sThisVal === 'js-web') {
  34.             web = true;
  35.             $('.courseBody ul').append('<li>JS-Web</li>')
  36.             price += 490;
  37.         }
  38.     });
  39.     $('input[type=radio]').each(function () {
  40.         let temp = (this.checked ? $(this).val() : "");
  41.     if(temp==='online'){
  42.         price*=0.94;
  43.     }})
  44.     price = Math.floor(price)
  45.     price = price + ".00";
  46.     $("p").text(`Cost: ${price} lv.`);
  47.     if(fund&&app&&adv&&web){
  48.         $('.courseBody ul').append('<li>HTML and CSS</li>')
  49.     }
  50. });
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement