I have a slider using this html syntax:
<div id="theatre">
<a class="sliderImg" href="01.jpg" />some-text</a>
<a class="sliderImg" href="02.jpg" />another-description</a>
<a class="sliderImg" href="03.jpg" />whatever</a>
<a class="sliderImg" href="04.jpg" />whatever</a>
</div>
What I need to do is to hide the text of the a tags not the a tags themselves.
I got this but doesn’t work.
var imgCaptions = $("#theatre a.sliderImg").html();
$(imgCaptions).hide();
I can’t add a span because I use the content for some AJAX. The structure has to remain.
Many thanks for your help. Merry Xmas!
I’d suggest:
You could also use the
user-selectCSS property to prevent the text being selected:Or, possibly, use the
unselectableattribute on the elements themselves:Incidentally your HTML is malformed, the
/should not be in the opening tag (that’s only in the opening tag for void elements, such asinputorimg).References:
user-select.