Assign additional class to a div using Prototype 1.5/6

Senario:

You need to do something like this (only one div gets assigned class “hilit” at a time):

<div class = “thumbDivOther hilit” id=”thumb_intro” onclick=”showItem(‘intro’, this);”>

Code:

currHilitDiv.removeClassName(‘hilit’);
//This doesn’t work in IE6
//div.addClassName(‘hilit’);
Element.addClassName(div, ‘hilit’);
currHilitDiv = div;

Advertisements

One Response to “Assign additional class to a div using Prototype 1.5/6”

  1. Florian Traverse Says:

    You should give a try to $(div).addClassName(‘hilit’) it works well and it’s smarter !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: