<div class="boxen checkedzahlen" id="box41_0_1">
41
<input type="checkbox" value="1" name="cb41_0_1" id="cb41_0_1" checked="checked"/>
</div>
如果单击$(this)
(类boxen
),我如何使文本41
具有动画效果?
this > *
不工作。this:children
也是如此。
发布于 2009-10-29 23:27:08
$("#divID").html()将获取其中的文本。
发布于 2009-10-30 02:45:47
您可以将div的内容包装在一个跨度中,然后将输入移到该跨度之外。然后,您可以为跨度设置动画。如下所示:
$('.boxen').each(function() {
var $thisBox = $(this);
$thisBox.wrapInner('<span></span>');
$thisBox.find('input').appendTo($thisBox);
});
$('.boxen span').animate({fontSize: '28px'}, 400);
您还可以将直接的DOM脚本与jQuery混合使用,如下所示:
$('.boxen').each(function() {
var newSpan = document.createElement('span');
newSpan.innerHTML = this.firstChild.nodeValue;
this.firstChild.nodeValue = '';
$(this).prepend(newSpan);
});
$('.boxen span').animate({fontSize: '28px'}, 400);
无论哪种方式都应该有效。
https://stackoverflow.com/questions/1644342
复制相似问题