+ 10

Project JavaScript Tools

When I was coding in JavaScript I noticed that creating / getting / styling an element took up a lot of space and was very annoying to write again and again. So now I might make a file with functions which you can copy to make JavaScript a bit shorter. One of my ideas was to use write("#Id") instead of document.getElementById("Id").innerHTML Please let me know if this is a good idea and if so what other functions I should add.

7th Mar 2017, 2:36 PM
The Coding Sloth
The Coding Sloth - avatar
4 Respuestas
+ 3
you can make constructor functions in separate referenced files and instantiate objects from them in your primary js code
7th Mar 2017, 4:56 PM
seamiki
seamiki - avatar
+ 7
Version 1.0 is done, you now can use: - get("#id") instead of document.getElementById("id") - say("#id","message") instead of document.getElementById("id").innerHTML - create("element") instead of document.createElement("element")
7th Mar 2017, 6:55 PM
The Coding Sloth
The Coding Sloth - avatar
+ 7
Version 1.1 is done, you now can use: - get(".class") instead of document.getElementsByClassName("class") - get("<tag") instead of document.getElementsByTagName("tag")
7th Mar 2017, 7:58 PM
The Coding Sloth
The Coding Sloth - avatar