Prototyping 12 November 2012: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 7: Line 7:
   var newdiv = document.createElement('div');
   var newdiv = document.createElement('div');
   document.body.appendChild(newdiv)
   document.body.appendChild(newdiv)
Removing stuff is slightly indirect as you have to ask the element's "parent" to remove it's "child":
  var delme = document.getElementById("ads");
  delme.parentNode.removeChild(delme);
Continued on... http://commons.oreilly.com/wiki/index.php/Greasemonkey_Hacks/Getting_Started#Add_or_Remove_Content_on_a_Page

Revision as of 10:46, 12 November 2012

Javascript in other contexts: Greasemonkey

  • Archive.org radio ?

Creating new content on the page...

 var newdiv = document.createElement('div');
 document.body.appendChild(newdiv)

Removing stuff is slightly indirect as you have to ask the element's "parent" to remove it's "child":

 var delme = document.getElementById("ads");
 delme.parentNode.removeChild(delme);


Continued on... http://commons.oreilly.com/wiki/index.php/Greasemonkey_Hacks/Getting_Started#Add_or_Remove_Content_on_a_Page