You have 2 separate classnames there--'selected' and 'insense-selected'. Anyway, why don't you just add the class to the hovered element and save yourself some trouble? Because wrapping a strong or dd element with a div is certainly asking for a lot of trouble.
On Thu, Nov 26, 2009 at 3:50 PM, coldwired <co...@coolwired.net> wrote: > > Hi, > > I'm trying to append an div element around the element that triggers the on > hover event, then remove the div on mouse out (blur). I normally would use > addClass / removeClass but this leaves class="" when the class is removed > and not the original state of the html. Here's my code, I can't work out how > to remove the appended div correctly... : > > jQuery("p,h1,h2,h3,span,li, dd, dt,b,em,strong").hover(function() { > jQuery('<div > class="selected"></div>').append(jQuery(this).clone()).html(); > active = true; > > }, function() { > jQuery(".insense-selected").remove(); > active = false; > }); > > This doesn't work as expected, can anyone help out? A solution to either > problem described would suffice! > > Thanks, > Colin. > -- > View this message in context: > http://old.nabble.com/Remove-appended-element-tp26534745s27240p26534745.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > >