Simple Calculator Program Using jQuery in HTML

Simple jQuery and HTML Calculator is a simple online calculator application built with JavaScript (jQuery) and an HTML table.

Must Read: Calculator App With jQuery and Bootstrap | SimpleCalculadora

Simple Calculator Program Using jQuery Details

Post NameSimple HTML Calculator jQuery
Author Namesaimanmoreno
CategoryCalculator
Official PageClick Here
Official Websitegithub.com
Publish DateSeptember 23, 2021
Last UpdateJune 29, 2023
DownloadLink Below
LicenseMIT

How to make use of it:

1. Add the calculator buttons to the HTML table as follows:

<table>
  <tr>
    <td colspan="4"><input id="display" name="display" disabled></input>
    </td>
  </tr>
  <tr>
    <td><button id="button1" value="1">1</button></td>
    <td><button id="button2" value="2">2</button></td>
    <td><button id="button3" value="3">3</button></td>
    <td><button id="addButton">+</button></td>
  </tr>
  <tr>
    <td><button id="button4" value="4">4</button></td>
    <td><button id="button5" value="5">5</button></td>
    <td><button id="button6" value="6">6</button></td>
    <td><button id="subtractButton">-</button></td>
  </tr>
  <tr>
    <td><button id="button7" value="7">7</button></td>
    <td><button id="button8" value="8">8</button></td>
    <td><button id="button9" value="9">9</button></td>
    <td><button id="multiplyButton">*</button></td>
  </tr>
  <tr>
    <td><button id="clearButton">C</button></td>
    <td><button id="button0" value="0">0</button></td>
    <td><button id="equalsButton">=</button></td>
    <td><button id="divideButton">&#247;</button></td>
  </tr>
</table>

2. Load JavaScript calc.js after jQuery.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/calc.js"></script>

3. Apply CSS styles to the calculator.

button {
  font-size: 200%;
  width: 80px;
  height: 80px;
  font: normal 40pt Tahoma;
  border-radius: 5pt;
}

input {
  font-size: 40px;
  width: 330px;
  height: 80px;
  text-align: right;
  border-radius: 5pt;
  color: black;
}

4. Override default variables if necessary.

// variable buffer used to store all recent calculations
var buffer = '';

// variable to store the last operation
var lastOperador = '';

// variable to store the last calculation
var lastCalc = ''; 

// default display selector
var display = $('#display');

See Demo And Download

simple-html-calculator-jquery

Official Website(saimanmoreno): Click Here

This superior jQuery/javascript plugin is developed by saimanmoreno. For extra Advanced Usage, please go to the official website.

Related Posts

VenoBox-Responsive-jQuery-Lightbox-Plugin

Responsive Image Gallery Lightbox jQuery Plugin | VenoBox

VenoBox is a responsive jQuery modal window plugin suitable for images, embedded content, iFrames, Google Maps, Vimeo, and YouTube videos. The big difference compared to many other…

Google-Translate-Dropdown-Customize-With-Country-Flag

Google Translate Dropdown Customize With Country Flag | GT API

Flag google translates jQuery text that takes advantage of the Google Cloud Translation API to translate web content between languages by selecting a country from the dropdown…

Bootstrap-Fileinput

HTML 5 File Input Optimized for Bootstrap 4.x./3.x with File Preview | Bootstrap Fileinput

bootstrap-fileinput is an improved HTML 5 file input  Bootstrap 5.x, 4.x and 3.x with file preview for different files, provides multiple selections, resumable section uploads, and more….

HStack-and-VStack-in-CSS

CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…

Floating-Whatsapp-Chat-Button

How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

Leave a Reply

Your email address will not be published. Required fields are marked *