javascript - DOM how to add more than one style in a div -
i'm trying add more 1 style attribute using dom setattribute
, doesn't work. how can using javascript?
var modificar = document.getelementbyid('opciones'); modificar.setattribute('style','float:left'); modificar.setattribute('style','margin:0px');
setattribute
working ok, since invoking twice, result of first call gets overridden second one.
either do:
modificar.setattribute('style','float: left; margin:0px;');
or use style
attribute suggested in answer.
Comments
Post a Comment