javascript - Using jquery to find the number of characters in img src -
i have image slider:
<ul class="slider"> <li><img src=""></li> <li><img src=""></li> <li><img src=""></li> </ul>
if length of characters <=41
, want remove li
tag. tried following code not working
var li = $(".slider ul > li"); var $img = $(".slider > ul > li img").attr("src"); if ($img == length(41)) { li.parentnode.removechild(li); }
this snippet it:
$(".slider > ul > li img").filter(function(){ return $(this).attr('src').length <= 41; }).closest('li').remove();
Comments
Post a Comment