Code not executing more than once after upgrade to jQuery 1.4.2
This is my jQuery Code
- $j("#hideBtn a").addClass("inactive");
$j("#showBtn a").addClass("active");
$j("#hideBtn a").click(function(){
var hideEditor = $j(this).attr("href");
$j(hideEditor).tinymce().remove();
$j("#showBtn a[href^="+hideEditor+"]").removeClass("active");
$j("#hideBtn a[href^="+hideEditor+"]").removeClass("inactive");
$j("#showBtn a[href^="+hideEditor+"]").addClass("inactive");
$j("#hideBtn a[href^="+hideEditor+"]").addClass("active");
});
$j("#showBtn a").click(function(){
var showEditor = $j(this).attr("href");
if($j(showEditor).tinymce()){
}else{
$j(showEditor).tinymce(tinymceConfigs[0]);
$j("#hideBtn a[href^="+showEditor+"]").removeClass("active");
$j("#showBtn a[href^="+showEditor+"]").removeClass("inactive");
$j("#hideBtn a[href^="+showEditor+"]").addClass("inactive");
$j("#showBtn a[href^="+showEditor+"]").addClass("active");
}
});
And this is the HTML
- <div id="buttons">
<div id="hideBtn">
<a href="#mceEditorBody" id="hideButton" class="inactive">HTML</a>
</div>
<div id="showBtn">
<a href="#mceEditorBody" id="showButton" class="active">Visual</a>
</div>
<div style="clear: both;"></div>
</div>
So what happens is that it will switch the style of the button depending on what was clicked. This will only work on the very first instance on the page and no where else. This used to work in jQuery 1.3.x
My suspicions is on how jQuery 1.4.2 has improved the addClass removeClass functions are screwing up on me.
Suggestions?