I need get the same type of array that this.form.elements returns, with input names as array keys.
I tried this.toArray(), but even though it looks the same, it's missing the name keys (the keys are numbers).
Here's the full function:
(function( $ ) {
$.fn.blah = function(){
var that = this;
return this.each(function(){
$(this).bind('change', function(){
var matches1 = that.toArray(); // this doesn't work
var matches2 = this.form.elements; // this works.
console.log(matches1); // but both arrays look the same. wtf?
console.log(matches2);
return true;
}).change();
});
};
})(jQuery);
using it as $("input").blah();
this.$("input").somefunction()....