I have seen a few different methods for adding classes to dynamically created elements using JQuery.
I'm most familiar with
$("<div />").addClass("class1 class2");
however I have seen a lot of
$("<div />", {
class : "class1 class2"
});
When I test out the second method in a Fiddle I can see both class1 and class2 are applied.
however, when applied to what i'm working on
// this does not work
var b = $("<div id='tweetBox' />", {
class : "triangle-right right"
});
// this works
var b = $("<div id='tweetBox' />").addClass("triangle-right right");