GithubHelp home page GithubHelp logo

joaocunha / jquery-maskmoney Goto Github PK

View Code? Open in Web Editor NEW

This project forked from plentz/jquery-maskmoney

0.0 0.0 0.0 60 KB

jQuery plugin to mask data entry in the input text in the form of money (currency).

Home Page: http://plentz.github.com/jquery-maskmoney/

License: MIT License

jquery-maskmoney's Introduction

Just a simple way to create masks to your currency form fields with jQuery.


Show Time!

To view a complete demonstration of it's features and usage, access our examples page!


Usage:

	<head>
		<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript"></script>
		<script src="jquery.maskMoney.js" type="text/javascript"></script>
	</head>
	<body>
		<input type="text" id="currency" />
	</body>
	<script type="text/javascript">
	$(function(){
		$("#currency").maskMoney();
	})
	</script>

Options:

The options that you can set are:

  • symbol: the symbol to be displayed before the value entered by the user(example: "US$"). default: ''
  • symbolStay: set if the symbol will stay in the field after the user exists the field. default: false
  • thousands: the thousands separator. default: ','
  • decimal: the decimal separator. default: '.'
  • precision: how many decimal places are allowed. default: 2
  • defaultZero: when the user enters the field, it sets a default mask using zero. default: true
  • allowZero: use this setting to prevent users from inputing zero. default: false
  • allowNegative: use this setting to prevent users from inputing negative values. default: false

IMPORTANT: if you try to bind maskMoney to a read only field, nothing will happen, since we ignore completely read only fields. So, if you have a read only field, try to bind maskMoney to it, it will not work. Even if you change the field removing the readonly property, you will need to re-bind maskMoney to make it work.


Bonus!

We have 2 bonus methods that can be useful to you:

  • .maskMoney('destroy') which removes maskMoney from an element.
  • .maskMoney('mask') which causes maskMoney to actually apply the mask to your input.

Contributors:


License:

jQuery-maskMoney is released under the MIT license.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.