I am trying to understand how chained function work and in particular how is it possible to pass the selected element to the chained functions.
Assuming that we have a chained function as follow:
var func = {};
func.remove= function() {
$(this).remove();
}
How can I select an element by jQuery or JavaScript and pass it to the chained function as follow:
var elm = $("foo");
elm.func.remove();
OR
var elm2 = document.getElementById("foo");
elm2.func.remove();