+ 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.
4 Respuestas
+ 3
you can make constructor functions in separate referenced files and instantiate objects from them in your primary js code
+ 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")
+ 7
Version 1.1 is done, you now can use:
- get(".class") instead of
document.getElementsByClassName("class")
- get("<tag") instead of
document.getElementsByTagName("tag")