I wrote something that uses document.getElementById a lot so I was wondering if instead I should just make a function like:
function gid (id) {
return document.getElementById(id);
}
and then just call it like:
alert(gid("test").innerText);
No, there's no reason not to. Typically most people use jQuery for stuff like this though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With