Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main.js:4 Uncaught TypeError: $container.setBackgroundColor is not a function
- window.onload = function () {
- var $container = new View("container");
- $container.setBackgroundColor("#E9425B");
- document.body.append($container);
- };
- class View{
- constructor(id){
- this.id = id;
- this.view = document.createElement(this.id);
- return this.view;
- };
- get(){
- return document.getElementsByTagName(this.id);
- };
- setText(text){
- this.get().innerText = text;
- };
- setBackgroundColor(color){
- this.get().style.backgroundColor = color;
- };
- create(id){
- if(id != null){
- this.id = id;
- }
- };
- addChild(child){
- console.log(child);
- this.get().append(child);
- };
- }
Add Comment
Please, Sign In to add comment