From d195582cf808d453827c5c23afa023e0817cabb2 Mon Sep 17 00:00:00 2001 From: ninadsp Date: Sat, 29 May 2010 18:59:27 +0530 Subject: [PATCH] Refactored addClass() and removeClass() to use jQuery's $.addClass() and $.removeClass() --- js/common.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/js/common.js b/js/common.js index 1d52c9770..686e24d07 100755 --- a/js/common.js +++ b/js/common.js @@ -202,7 +202,7 @@ function refreshNavigation() { function addClass(element, classname) { if (element != null) { - element.className += ' ' + classname; + $("#"+element).addClass(classname); //alert('set class: ' + classname + ', now: ' + element.className); } } @@ -213,9 +213,7 @@ function addClass(element, classname) function removeClass(element, classname) { if (element != null) { - element.className = element.className.replace(' ' + classname, ''); - // if there is no other class anem there is no leading space - element.className = element.className.replace(classname, ''); + $("#"+element).removeClass(classname); //alert('removed class: ' + classname + ', now: ' + element.className); } }