I tried looking at this post which has an almost identical title but despite trying the answer that appeared suitable, my code still isn't working.
I'm creating an element outside of the dom like this:
var e = $('<div class="alert"><div class="messageBox"><h1>'+type+'</h1><p class="message">'+message+'</p></div></div>');
On the next line, I'm attempting to manipulate it.
$('.alert',e).width($(window).width()).height($(window).height());
As you can see, I tried to define the context for the selector (the suggestion I saw in the other post) but it isn't working. Can someone point out to me what I've done wrong?