JQuery: Run animations on the element's contents
Posted
by
BHare
on Stack Overflow
See other posts from Stack Overflow
or by BHare
Published on 2010-12-29T21:07:26Z
Indexed on
2010/12/30
5:53 UTC
Read the original article
Hit count: 283
I have a div that has some padding, border, and style applied to it. Inside the div I have just some plain text. Something like this:
<div id=test style="border: 2px solid black; background-color: blue;">
The text I would like to animate
</div>
Normally to animate the contents I would do something like this:
$('#test > *').hide(1000);
But apparently the > *
only selects child elements, and not non-elements (text for example)
So my current work around is:
<div id=test style="border: 2px solid black; background-color: blue;">
<span>The text I would like to animate</span>
</div>
Making a span
that is not really needed.
© Stack Overflow or respective owner