I have some elements created with jQuery that are added in a iframe. I set a class to those elements from jQuery.I have a CSS rule that matches that class.
I see in Chrome clearlly that the CSS rule was not applied and the inspector confirms me that.
I see class=”messagesWrap” in the DOM, but it’s not interpreted by the browser, because .removeClass(“messagesWrap”) is also unable to remove the class.
I use the DOM editor from Chrome (“Elements” tab from Developer Tools), I double click the class attribute of the element in order to edit it and just press enter afterward to apply the “changes” without actually changing anything. This time, the CSS selector is applied correctly.
It’s possible adding a CSS class on an element that’s not part of a document (yet) just doesn’t work.
As a workaround, try generating it with class=”messagesWrap”, or adding the class after it’s been added to an actual document.