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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -