I have a code, using jQuery, that checks whether the correct image was clicked and then changes the image to red or green, according to whether the answer was correct. After that, it waits 2 seconds and reloads the page to show the next pictures pair. It works just fine using it on its own, but once I put it in the facebook application, it does not work properly.
In IE and Firefox, it changes color on the click but does not reload the page. In chrome, however, it does not even change the color on the click. Could it be the issue with the iframe or something? Do I need specific parameters when I use jQuery within an iframe?
The excerpt from my code looks like this:
jQuery(document).ready(function(){
jQuery('img#0').live("click", function(){
if (jQuery(this).hasClass("correct")){
jQuery(this).attr('src', "0g.png");
} else{
jQuery(this).attr('src', "0r.png");
}
});
});
As you can see, I have even changed $ to jQuery to prevent the conflict with other possible libraries.
Any ideas how I can get this to work?