There is an Element function and Element.prototype.draw , used to create the form and input in this form. Completely confused in the assignment. those. The InputElement constructor inherits the Element and adds its type field to inputs, but, unfortunately, I don’t understand how I can correctly set the Element.prototype.draw line with an InputElement that would add this type .
function Element (name, template, type) { this.name = name; this.classes = ["formClass"]; this.template = template; }; // debugger; function InputElement (name, template, type) { Element.call(this); this.type = type; }; Element.prototype.draw = function (parentElement) { $Element = $(this.template); $Element.attr("name", this.name); $Element.addClass(this.classes.join("")); $Element.attr("type",) $(parentElement).prepend($Element); return $Element; }; var testForm = new Element("form", "<form></form>"); var testInput = new Element("input", "<input></input>", "password"); testForm.draw("body"); testInput.draw("form");