Q:

Change css background color in jquery

I have done an append using the following code, where menuElement is a id of a div and
appendStr ="<span class="bubbleClass"></span>";
$(menuElement).append(appendStr);

However, when i try $(menuElement+ ".bubbleClass").css("background-color", "red"); it doesnt work.
I want the specific div id stored in  menuElement variable to be reflected.

A:

Since you have dynamically added the item to the DOM, you need to use .find() to access it:
$(menuElement).append(appendStr).find('.bubbleClass').css({
    backgroundColor:'red',
    display:'inline'
});

That is an example based on the limited code you provided, but the use of .find() is the key.
Edited to include the display CSS you said you needed to add as well.

