Filter function not work in Chrome and Firefox browser

Filter function not work in Chrome and Firefox browser

I modifed the code from the sample code given by the CSS example (from JQuery v1.9):

$("span").click(function() {

    $("span").filter(function(index) {

                return $(this).css('background-color') == 'yellow';

     }).css('background-color', 'white');

     $(this).css('background-color', 'yellow');

});

Whenever user click a word, it should remove all those highlight words and highlight the clicked word ONLY. This code works fine in IE 8 but it could not works in Chrome