css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="row">
  <div class="col-md-4">
    <ul class="calculatorList">
      <li>
        <a class="link" data-id="title1">Generating Customer Caclulations</a>
      </li>
      <li>
        <a class="link" data-id="title2">Calculators</a>
      </li>
    </ul>
    <ul class="calc-nav">
      <li class="calc">
        <a class="link" data-id="form1">Lifetime Value Calculator</a>
      </li>
      <li class="calc">
        <a class="link" data-id="form2">Breakeven Analysis</a>
      </li>
      <li class="calc">
        <a class="link" data-id="form3">Total Audience Calculator</a>
      </li>
      <li class="calc">
        <a class="link" data-id="form4">Number of Offers Calculator</a>
      </li>
      <li class="calc">
        <a class="link" data-id="form5">Margin Calculator</a>
      </li>
    </ul>
  </div>

  <div class="col-md-8 forms">
    <form id="form1">
      <h3>Lifetime Value Calculator</h3>
      <p>Calculator which determines the lifetime value of a customer</p>
      <p>The average dollar amount of a client's reorder: </p>
      <input value="" type="text" class='num1' placeholder="$50.00" />
      <p> How many times per year does an average client buy from you? </p>
      <input value="" type="text" class='num2' placeholder="12" />
      <p> On average, how many years does a client continue doing business with you? </p>
      <input value="" type="text" class='num3' placeholder="6" />
      <p>Customer Lifetime Value: </p>
      <input value="" type="text" class='total' placeholder="$3000.00" readonly/>
    </form>

    <form id="form2">
      <h3>Breakeven Analysis Calculator</h3>
      <p> Calculator which determines your breakeven analysis</p>
      <p> Customer Lifetime Value: </p>
      <input value="" type="text" class='num1' placeholder="$3000.00" />
      <p> Gross Margin Percentage: </p>
      <input value="" type="text" class='num2' placeholder="60.00%" />
      <p> Marin Per Customer: </p>
      <input value="" type="text" class='total1' placeholder="$1800.00" readonly/>
      <p> Monthly Advertising Spend: </p>
      <input value="" type="text" class='num3' placeholder="$2000.00" />
      <p> Number of Customers to breakeven:
        <p>
          <input value="" type="text" class='total2' placeholder="1.11" readonly/>
    </form>

    <form id="form3">
      <h3>Total Audience Calculator</h3>
      <p>Calculator which determines your total audience</p>
      <p> Number of residence mailed: </p>
      <input value="" type="text" class='num1' placeholder="50,000" />
      <p> Average Number of people per residence: </p>
      <input value="" type="text" class='num2' placeholder="4.25" />
      <p> Total potential audience </p>
      <input value="" type="text" class='total' placeholder="212,500" readonly/>
    </form>

    <form id="form4">
      <h3>Number of Offers</h3>
      <p>Calculator which determines your total number of offers</p>
      <p>Number of residence mailed: </p>
      <input value="" type="text" class='num1' placeholder="50,000" />
      <p> Number of Coupons: </p>
      <input value="" type="text" class='num2' placeholder="6" />
      <p> Total number of coupons </p>
      <input value="" type="text" class='total' placeholder="300,000" readonly/>
    </form>

    <form id="form5">
      <h3>Margin Calculator</h3>
      <p>Calculator which determines your margins</p>
      <p>Revenue: </p>
      <input value="" type="text" class='num1' placeholder="$3000.00" />
      <p> Cost of Goods Sold: </p>
      <input value="" type="text" class='num2' placeholder="$2250.00" />
      <p> Margin: </p>
      <input value="" type="text" class='total1' readonly placeholder="750.00" readonly/>
      <p> Margin Percentage: </p>
      <input value="" type="text" class='total2' readonly placeholder="25%.00" readonly/>
    </form>
  </div>
</div>
            
          
!
            
              form {
  margin-left: 10px;
}

ul {
  padding-left: 0;
}

.calc {
  background-color: rgb(246, 246, 246);
  color: black;
  padding: 10px 0px 10px 10px;
  border-bottom: 1px solid #dedede;
  text-align: left;
  font-size: 15px;
  line-height: 24px;
  cursor: pointer;
  list-style-type: none;
  margin-bottom: -0.1px;
}

.link {
  display: block;
  color: black;
}

.focus {
  color: #005aaa;
}

.title {
  background-color: rgb(0, 90, 170);
  color: rgb(255, 255, 255);
  font-size: 22px;
  font-weight: 600;
  line-height: 26px;
  padding: 10px 0px 10px 10px;
  margin-bottom: 0px;
}

.calculatorList {
  background-color: rgb(0, 90, 170);
  color: rgb(255, 255, 255);
  font-size: 22px;
  font-weight: 600;
  line-height: 26px;
  padding: 10px 0px 10px 10px;
  list-style-type: none;
}

p {
  padding-top: 10px;
  margin-bottom: 0px;
}

            
          
!
            
              jQuery(function($) {
  var num1 = new AutoNumeric("#form1 .num1", "dollar");
  var num2 = new AutoNumeric("#form1 .num2", "integer");
  var num3 = new AutoNumeric("#form1 .num3", "dotDecimalCharCommaSeparator");
  var total0 = new AutoNumeric("#form1 .total", "dollar");

  $("#form1 .num1, #form1 .num2, #form1 .num3").on("change keyup", function() {
    var total = num1.getNumber() * num2.getNumber() * num3.getNumber();
    total0.set(total);
  });

  var number1 = new AutoNumeric("#form2 .num1", "dollar");
  var number2 = new AutoNumeric("#form2 .num2", "percentageUS2dec");
  var total1 = new AutoNumeric("#form2 .total1", "dollar");
  var number3 = new AutoNumeric("#form2 .num3", "dollar");
  var total2 = new AutoNumeric("#form2 .total2");

  $("#form2 .num1, #form2 .num2, #form2 .num3").on("change keyup", function() {
    var totalOne = number1.getNumber() * number2.getNumber() / 100;
    total1.set(totalOne);
    var totalTwo = totalOne === 0 ? 0 : number3.getNumber() / totalOne;
    total2.set(totalTwo);
  });

  var number4 = new AutoNumeric("#form3 .num1", "integer");
  var number5 = new AutoNumeric("#form3 .num2", "dotDecimalCharCommaSeparator");
  var total3 = new AutoNumeric("#form3 .total", "integer");

  $("#form3 .num1, #form3 .num2").on("change keyup", function() {
    var total = number4.getNumber() * number5.getNumber();
    total3.set(total);
  });

  var number6 = new AutoNumeric("#form4 .num1", "integer");
  var number7 = new AutoNumeric("#form4 .num2", "integer");
  var total4 = new AutoNumeric("#form4 .total", "integer");

  $("#form4 .num1, #form4 .num2").on("change keyup", function() {
    var total = number6.getNumber() * number7.getNumber();
    total4.set(total);
  });

  var number8 = new AutoNumeric("#form5 .num1", "dollar");
  var number9 = new AutoNumeric("#form5 .num2", "dollar");
  var total5 = new AutoNumeric("#form5 .total1", "dollar");
  var total6 = new AutoNumeric("#form5 .total2", "percentageUS2dec");

  $("#form5 .num1, #form5 .num2").on("change keyup", function() {
    var totalOne = number8.getNumber() - number9.getNumber();
    total5.set(totalOne);
    var totalTwo = totalOne === 0 ? 0 : totalOne / number8.getNumber() * 100;
    total6.set(totalTwo);
  });

  $(".calc-nav li a").on("click", function() {
    toggleForms($(this).data("id"));
    $(this)
      .parent()
      .siblings()
      .find("a")
      .removeClass("focus");
    $(this).addClass("focus");
  });
  $(".calc-nav li:first a").click();

  function toggleHeaders(title) {
    
  }

  function toggleForms(id) {
    $(".forms form").hide();
    $(".forms #" + id).show();
  }
});

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console