如果从 jquery mobile 基本结构中跳出是不好的做法,我会感到很痛苦。在我的示例中,我得到了完全相同的代码。但在另一个中,我在 -tag之前添加了一个 div。这让我再看一眼,因为 css 不正确。不好吗?它打破了我好看的清单。有什么好的解决方案吗?
原因是因为我想要对列表中的信息进行一些控制,以使用 som jQuery 显示和隐藏 div。我会很容易地解决这个问题,给 li 标签一个类并隐藏和显示它。但我还是有点困惑
如果我有这个代码(取自 jquery 演示页面):
<li>
<a href="#">
<h2>
Stephen Weber</h2>
<p>
<strong>You've been invited to a meeting at Filament Group in Boston, MA</strong></p>
<p>
Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the
jQuery team.</p>
</a>
<p class="ui-li-aside">
<strong>6:24</strong>PM</p>
</li>
它将生成这个html:
<li class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-btn-up-c" data-corners="false"
data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="false"
data-iconpos="right" data-theme="c">
<div class="ui-btn-inner ui-li">
<div class="ui-btn-text">
<p class="ui-li-aside ui-li-desc">
<strong>6:24</strong> PM
</p>
<a class="ui-link-inherit" href="#">
<h2 class="ui-li-heading">
Stephen Weber</h2>
<p class="ui-li-desc">
<strong>You've been invited to a meeting at Filament Group in Boston, MA</strong>
</p>
<p class="ui-li-desc">
Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the
jQuery team.</p>
</a>
</div>
</div>
</li>
但是,如果我在我的代码中添加一个 div,如下所示:
<li>
**<div>**
<a href="#">
<h2>
Stephen Weber</h2>
<p>
<strong>You've been invited to a meeting at Filament Group in Boston, MA</strong></p>
<p>
Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the
jQuery team.</p>
</a>
<p class="ui-li-aside">
<strong>6:24</strong>PM</p>
</div>
</li>
它将生成这个html:
<li class="ui-li ui-li-static ui-btn-up-c">
<div>
<p class="ui-li-aside ui-li-desc">
<strong>6:24</strong> PM
</p>
<a class="ui-link" href="#">
<h2 class="ui-li-heading">
Stephen Weber</h2>
<p class="ui-li-desc">
<strong>You've been invited to a meeting at Filament Group in Boston, MA</strong>
</p>
<p class="ui-li-desc">
Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the
jQuery team.</p>
</a>
</div>
</li>