JavaScript/jQuery short hand function definitions
Posted
by Baddie
on Stack Overflow
See other posts from Stack Overflow
or by Baddie
Published on 2010-04-11T07:20:58Z
Indexed on
2010/04/11
7:23 UTC
Read the original article
Hit count: 334
I'm using a jQuery plugin that has its functions defined as such:
$('#mydiv').pluginAction({
someproperty: val,
format: 'mm hh',
labels: ['yes', 'no', 'maybe'],
labels1: ['never', 'always']
});
In my HTML page, I have multiple DIVs that have the same properties for format
, labels
, labels1
, but different values for someproperty
. Is there some type of JavaScript notation I can take advantage of to shorten the definition so that I don't have to have duplicate code?
© Stack Overflow or respective owner