Sunday, 15 February 2015

html - Editing an item's style via JavaScript? -



html - Editing an item's style via JavaScript? -

this question has reply here:

changing css values javascript 7 answers

i'm looking help regarding how edit object's style in separate css file via js. example, if have object style #objectid {left: 0%;} in css file, how go changing left property via javascript? i'm aware can object.style.property hasn't been working me of late. what's efficient/easy method of doing this? in advance.

the standard way:

document.getelementbyid('objectid').style.left = "10%";

but if you're worried efficiency, seek not modify styles straight using js... seek adding/removing classes instead.

javascript html css

No comments:

Post a Comment