scriptygoddess

01 Dec, 2007

Change class name assignment with javascript

Posted by: Jennifer In: Javascript

Example:
<div id="mydiv" class="current">Content</div>

To change class assignment:
document.getElementById('mydiv').className = 'notcurrent';

To remove the class assignment:
document.getElementById('mydiv').className = '';

1 Response to "Change class name assignment with javascript"

1 | Tom-Eric

December 3rd, 2007 at 1:12 am

Avatar

To break the example:
<div id="mydiv" class="current some-other-class">Content</div>

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements