How to write javascript to style an element in single line?
For example,
document.getElementById('add_new').style.top=-15;
document.getElementById('add_new').style.position='absolute';
It is possible to make it array or single line to style the element using javascript itself?
How to provide a shorthand for writing recurring accesses to objects?
I don’t recommend it, but you could do something like so to get it in “1” line:
or another way:
thanks to Are there legitimate uses for JavaScript's "with" statement?