Im having an issue with chaining. For example, the following will work
$('#myActivityFeed .bv_default_player_pic').attr("src", url);
$('#myActivityFeed. bv_default_player_pic').removeClass().addClass('badge');
yet the following will not:
$('#myActivityFeed .bv_default_player_pic').attr("src", url).removeClass().addClass('badge');
as far as I know, you should be able to chain these events.... any thoughts as to why I cannot?
Your example should work. Here's a live example. It shows my Gravatar with a red border around it via class "bv_default_player_pic", inside a div with the id
value "myActivityFeed". When you click the button, it executes your code (unchanged, literally copied-and-pasted):
$('#myActivityFeed .bv_default_player_pic').attr("src", url).removeClass().addClass('badge');
...which sets the src
to be your Gravatar, removes all classes, and adds class "badge" (making the border black, with my CSS).
Works just fine. The problem lies elsewhere (is url
defined?).