Regardless of what the HTML is, it’s bad practice to create several nested HTML elements within a jQuery call like that. For example, creating the elements one at a time and chaining the methods reduces the work that jQuery has to do:
That code is a little ugly with all the chaining; you can save newly created elements to variables instead to clean it up if you want. Regardless, it’s better than creating all those elements all at once in one jQuery call, which could potentially be why the code isn’t working, though I’d have to see the HTML to really know.