Skip to content

JQuery plugin to manage operations between fields and/or html elements

Notifications You must be signed in to change notification settings

giovazz89/form-operations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

form-operations

JQuery plugin to manage operations between fields and/or html elements

usage

$('result_field_selector').operation('query_string');

OR

options = {query: 'your query'};
$('result_field_selector').operation(options);

It can be used on HTML elements other than INPUT too!

options

OptionDefaultInput
query-Mathematical expression with jquery selectors between {} ('1 + {#my-field}')
events['change']array of events that trigger recalculation (event on query elements)
checkNewfalseif set to true checks for fields inserted in the DOM after initialization
timedCheck0check changes every specified milliseconds (n <= 0 is disabled)
fieldsDecimalSeparator'.'decimal separator used in the input fields
fieldsThousandSeparator''thousand separator used in the input fields
resultDecimalSeparator'.'decimal separator used in the result field
resultThousandSeparator''thousand separator used in the result field
decimalDigits-1to fix the number of decimal digits in the result input a number 0 <= n <= 20

multiple fields selector

If a selector has been used for multiple fileds ('{.myfields}' or others) it calculates all their values (prioritizing multiplications and divisions)

EXAMPLE

$('#result selector').operation('... - 1 + {.myfields} * 5 ...');

//it will become:
('... - 1 + {myfields 1 value} * {myfields 2 value} * ... * 5);

IF YOU WANT THAT TO BE A SUM

$('#result selector').operation('... - (1 + {.myfields}) * 5 ...'); //...add parenthesis!! ;)

About

JQuery plugin to manage operations between fields and/or html elements

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •