I need a result, like this:
getter
$('selector').myplugin().val();
setter
$('selector').myplugin().val('value');
and i don't want result like this:
$('selector').myplugin({ value: 'value' });
or
$('selector').myplugin('setValue', 'value');
start to define plugin:
(function ($) {
$.fn.myplugin= function () {
return this.each(function () {
var $this = $(this);
...
});
};
}(jQuery));
this question - How to create a jQuery plugin with methods? not help..