I want to create a JavaScript function that works like,
element.mycustomfunction(options);
I know how to do this with jquery but I don't know how to do this with pure JavaScript.
Here is what I have did in my code.
var elm = document.getElementById('someid');
I want do this,
elm.mycustomfunction(options_object);
I have tried,
(function(){
HTMLElement.prototype.mycustomfunction = function(options){
console.log( options );
}
})();
but it doesn't console anything. Is there something what I'm missing?
Thanks in Advance