kbwood / calculator Goto Github PK
View Code? Open in Web Editor NEWjQuery Calculator Plugin
jQuery Calculator Plugin
First off, excellent work on the jQuery calculator!
I have a couple of questions about how it's handling operators.
If I do the following...
Doing the above closed the calculator and populates my input field with 60.
However, if you press the + key before pressing ENTER (step 6) to close the calculator the input field actually updates with 120.
It's like the last operator type affects the final calculation. Windows calculator works like this, but regular calculators don't always. It depends on what type of calculator it is.
Question 1: Is there a way to discard that last operator in the formula? Or is there a setting that controls this?
Question 2: Using a 10 key adding machine if I type 15+30+15+++++ would key adding the last value typed. So in this example you would end up with a total of 135. Does your calculator support this type entry?
Thanks,
Chris
Hello keith,
Can't find how to use it in a bootstrap modal.
It's hiding behind the modal.
Do you have a way for it.
<div class="modal fade " id="PopupCalc" role="dialog">
<div class="modal-dialog " style="width: 450px">
<div class="modal-content">
<div class="modal-header">
Calculator
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<input type="text" id="basicCalculator">
</div>
<div class="modal-footer">
<a class="close btn btn-default" data-dismiss="modal">Cancel</a>
</div>
</div>
</div>
</div>
$(function () {
$.calculator.setDefaults({ showOn: 'both', buttonImageOnly: true, buttonImage: 'calculator.png' });
$('#basicCalculator').calculator();
}
I get these weird ́╗┐' symbols before every locale related file and so the compression fails. I think you have created these files using visual studio which is inserting these BOM characters at the start of each file.
(You can open the file in command prompt and check)
I love Your calculator.
Have only 3 suggestions:
When I enter a number lets say 22 and then press back button it shows 2 and after pressing again it shows 0, now when I press new number lets say 5 it shows 05, but it should only show just 5
While pressing key from physical keyboard, if user have defined some specific decimalChar let say ',' it did not let user to add the decimalChar at all.
//Possible solution
_doKeyPress: function(e) {
..................
..................
if (plugin._showingCalculator || (div && !plugin.isDisabled(div))) {
var code = plugin._keyChars[ch === inst.options.decimalChar ? '.' : ch];
/**Change above line with => var code = plugin._keyChars[ch];*/
if (code) {
$('button[data-keystroke="' + code + '"]',
inst._mainDiv).not(':disabled').click();
}
return false;
}
..................
..................
},
I tried to set constrainInput to false, but no effect on the calculator, still can't entry non-numeric characters.
When step into the code, keypress handler returned false before constrainInput is checked.
I am new to jquery plugin Please tell me how can i use your caluclator and calander plugin in HTMl table
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.