- Where Developers Learn, Share, & Build Careers


I want to reuse some CSS class of a web page into a new div element that I have added . I am using Greasemonkey to redesign the page.

How can I add bar1 to style myDiv ?

Original Div:

  & lt; Div id = "bar1" class = "bar1" & gt;   

New div:

  var myDiv = document.createElement ('div');    

  myDiv.className = 'bar1';   

or

  myDiv.className = document.getElementById ('Bar 1'). ClassName;    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -