[jQuery] Behavior Problem
I added "addClass" to the behavior class, so it will recall the
behaviors when addClass is called.. but they spans start out as
".codeNumbersRow" then you click on it and it runs the function turns
it into ".codeNumbersRowSelected", but for some reason when you try
and click on it again it runs the ".codeNumbersRow Selected" behavior
and not the ".codeNumbersRow" one like it is suppose to..??
$(".codeNumbersRow").behavior('click', function() {
var lineNum = $(this).attr('id').substring(4);
$
(this).removeClass(".codeNumbersRow").addClass("codeNumbersRowSelected");
$
("#code"+lineNum).removeClass("codeRow").addClass("codeRowSelected");
});
$(".codeNumbersRowSelected").behavior('click', function() {
var lineNum = $(this).attr('id').substring(4);
$
(this).removeClass("codeNumbersRowSelected").addClass("codeNumbersRow");
$
("#code"+lineNum).removeClass("codeRowSelected").addClass("codeRow");
alert($(this).attr('class'));
});
Thanks!!
P.S. I also tried taking "addClass" out of the behavior class and just
put .append() on the end of each function, and the same thing happened.