I have a problem and I really searched for answers and I asked some persons.. but no solution. I have 3 'td' elements, they all belong to a class = "moreSpace" ... so when I click on a td element.. it changes its class to "deactivateAssignments" ... but the $(".moreSpace").mouseOver/mouseOut functions still have an effect on the element which its class was changed.. Why? please help me :(
(sorry for this mess, it is the first time that I post a problem here)
//DG
$(".moreSpace").mouseover(function(event) {
var id = event.target.id;
$('#'+id).css('color','#B5EABC')
});
$(".moreSpace").mouseout(function(event) {
var id = event.target.id;
$('#'+id).css('color','#24C635')
});
function reclass(){
$('#dg306').attr('class','moreSpace');
$('#dg632').attr('class','moreSpace');
$('#dg291').attr('class','moreSpace');
alert('in');
}
var actId = 2;
$(".moreSpace").click(function(event) {
reclass();
var id = event.target.id;
if (id == 'dg306'){
actId = 1;
} else if (id == 'dg632'){
actId = 2;
}else if (id == 'dg291'){
actId = 3;
}
switch (actId) {
case 1:
$('#dg306').toggleClass('moreSpace deactivateAssignments');
break;
case 2:
$('#dg632').toggleClass('moreSpace deactivateAssignments');
break;
case 3:
$('#dg291').toggleClass('moreSpace deactivateAssignments');
break;
}