【发布时间】:2011-03-07 07:21:46
【问题描述】:
我有这两行:
$target_box.children('a.ajax_trigger_title').addClass('opened_post_title');
jQuery('#'+$target_box.attr('id')+' a.ajax_trigger_title').addClass('opened_post_title');
第一行不起作用,但第二行起作用。为什么?
如果你必须知道,这里是相关的 HTML:
<div class="box" id="30" style="position: absolute; left: 350px; top: 0px; margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; ">
<h2>
<a class="ajax_trigger_title" id="open_30" href="http://keepskatinbro.com/2011/01/20/some-highlights-from-ksbs-throw-down-show-down/" rel="30">
<span>Highlights from KSB’s “Throw Down Show Down”.</span>
</a>
</h2>
</div>
$target_box 是类为“.box”的div
【问题讨论】:
标签: javascript jquery dom syntax