I was wondering how I can create features like jQuery. For instance:$(ID).function()
If the identifier is the identifier of the HTML element, $this is a function that returns the document.getElementById link of the "ID" element, and the function is a javascript custom function.
I am creating a small library that implements some functions. And I want to use this syntax without using jQuery.
Now my questions are: how can I implement this? What is the name of the flow that allows this?
Edit:
I want to do the following:
HTMLElement.prototype.alertMe = function () {alert (this.value);}
Then, when I call document.getElementById('html_input_id').alertMe(), it should show a warning with an input value. But
source
share