Firstly thank you for jQuery - I'm loving it.
I have an interesting situation where if I add a class within a click
event handler then the class does not get added. However if I add the
same class as part of my regular $(document).ready handling then all
is well.
To compound the problem, Safari 3.2.1 on Mac OS X exhibits the bad
behaviour but Firefox 3.0.9 on Mac OS X honours the class being added.
Here's the code that does not work on Safari, but is ok on FF:
var resultFieldset = $("#results fieldset");
$("#visualise").click(function() {
resultFieldset.addClass("progress");
});
Interestingly, executing hasClass("progress") immediately after the
addClass shows true on Safari even though the class appears not to be
added (I've also inspected the element via Safari developer tools and
indeed there is no class added).
If I change the code to:
var resultFieldset = $("#results fieldset");
resultFieldset.addClass("progress");
$("#visualise").click(function() {
resultFieldset.addClass("progress");
});
...then Safari and FF show the class on the page being ready (as you'd
expect).
Any ideas why Safari is not working in the first instance?
Kind regards,
Christopher
P.S. jquery-1.3.2.min.js