【发布时间】:2012-09-07 10:53:20
【问题描述】:
我正在使用这个插件:http://www.jquerynewsticker.com/
我需要将 li 的内容包含在 <a href=""></a> 中
<ul id="js-news">
<li class="news-item">This is text 1 ...</li>
<li class="news-item">This is text 2 ...</li>
<li class="news-item">This is text 3 ...</li>
<li class="news-item">This is text 4 ...</li>
</ul>
像这样:
<ul id="js-news">
<li class="news-item"><a href="my-form">This is text 1 ...</a></li>
<li class="news-item"><a href="my-form">This is text 2 ...</a></li>
<li class="news-item"><a href="my-form">This is text 3 ...</a></li>
<li class="news-item"><a href="my-form">This is text 4 ...</a></li>
</ul>
我认为字符串需要在这个字符串中。但我不知道怎么做:
script type="text/javascript">
$(function () {
$('#js-news').ticker({
});
});
</script>
【问题讨论】:
-
为什么用户不能编辑cms中的li?
-
@Kasper 在锚标签内包裹 li 元素在语义上是不正确的。
-
@freebird 我很确定它是有效的 HTML5,但在这种情况下,最好将
a放在li中 -
@jtheman:最终用户不知道该怎么做。
-
@freebird:不是li,而是li里面的内容
标签: jquery forms hyperlink html-lists