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 -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -