This is similar to this question: Jquery, hide & show list items after nth item
I would like to hide any listed items after the 3rd list item and append a "show more link" The link show more link has to direct to Show More... so that it will link to the correct product detail page.
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
<li>item 4</li>
<li>item 5</li>
</ul>
Here is the script I am using:
$('ul')
.find('li:gt(2)')
.hide()
.end()
.append(
$('<li><a href="javascript:Detail('2163230');">Show More...</a></li>').click( function(){
$(this).siblings(':hidden').show().end().remove();
})
);
Here is a link to a fiddle where the url has been replaced with a link to google instead: http://jsfiddle.net/jelane20/ecbwue8z/
Is there anyway to use javascript:Detail('2163230'); for the URL?