I have a carousel on my site, and if there are no elements my jquery seems to crash.
My HTML output without elements is…
<section class="gallery-viewport-twobedroomapartment viewer">
<ul>
</ul>
<a id="simplePrevious"><img alt="Left Arrow" src="_includes/images/larr.png"></a>
<a id="simpleNext"><img alt="Right Arrow" src="_includes/images/rarr.png"></a>
</section>
And my jQuery is…
$('.gallery-viewport-twobedroomapartment').carousel('#simplePrevious', '#simpleNext');
Is it possible to say if UL contains LI then run the function?
1 Answer