I have the following example: http://jsfiddle.net/LAMdV/
HTML:
<div id="imageSlider">
<span class="info" id="info1">
hello world
</span>
</div>
jQuery:
$('#imageSlider .info').click(function () {
var i = $(this).attr('id');
i = i.replace('info', '');
if ($('#imageSliders .info#info' + i).is(':visible')) {
alert("hide");
} else {
alert("show");
}
});
Why is the results of is:visible always showing false? Despite the fact it’s visible from the start! (In my actual scenario it’s previously hidden and then displayed)
Your markup has id “imageSlider” while your selector uses “#imageSliders” (plural).