How to add | (pipe) between list with jquery
The following is created dynamically.
<div id="footermenu">
<ul><li><a href="Nettbutikk.asp" title="" class="topactive">Nettbutikk</a></li>
<li><a href="Infosenter.asp" title="" class="">Infosenter</a></li>
<li><a href="Kontakt_oss.asp" title="" class="">Kontakt oss</a></li>
</ul>
</div&g开发者_高级运维t;
With this text:
Nettbutikk Infosenter Koatakt oss
I'd like to add | between to make like this.
Nettbutikk | Infosenter | Koatakt oss
Nettbutikk etc will be changed in future, so I thought I should use li:first and li:nth-child(2).
I tried this but it gives an error telling:
TypeError: $("#footermenu ul li:first") is null { message="$("#footermenu ul li:first") is null", more...}
$("#footermenu ul li:first").append(' | ');
How can I do this?
Works for me. Are you sure you're including jQuery properly?
精彩评论