I decided for myself to understand the simple principle of jQuery and ran into a problem. When I try to organize a simplified version of the library, I cannot call the functions that lie inside the function. Code example:
var jQ = function(el) { this.el = document.getElementById(el); } jQ.prototype.html = function(text){ this.el.innerHTML = text; return this; } jQ.prototype.css = function(key, value){ this.el.style[key] = value; return this; } // Использование jQ('bar').html('test');
new:new jQ('bar').html('test');- Grundy