0.0.2 • Published 4 years ago

calculating-form v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

calculating-form

Library to calculate form data

Start using

Install module using Node Package Manager

npm install calculating-form --save

Add calc-form script into your html

<script src="node_modules/calculating-form"></script>

In case you need get sum of inputs just add class calc to your input and class calc-form to the form itself.

In case you need to multiply two inputs or divide it, wrap inputs into any tag, add class calc to wrapper and attribute operation

Result of the operation will be displayed as a content of html tag with class calc-result

Allowed operations

  • ADD: Add value
  • SUBSTR: Substract value
  • DIV: Divide value
  • MULT: multiply value
<form class="calc-form">
        <input class="calc" operation="ADD" type="number" placeholder="number">
        <div operation="MULT" class="calc">
            <input type="number" placeholder="number">
            <input type="number" placeholder="number">
        </div>
        <div operation="DIV" class="calc">
            <input type="number" placeholder="number">
            <input type="number" placeholder="number">
        </div>
        <span class="calc-result"></span>
</form>
0.0.2

4 years ago

0.0.1

4 years ago