我有一个使用这个html语法的滑块:
<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>
我需要做的是隐藏标签的文本而不是标签本身.
我得到了这个但是没有用.
var imgCaptions = $("#theatre a.sliderImg").html(); $(imgCaptions).hide();
我无法添加span,因为我将内容用于某些AJAX.结构必须保留.
非常感谢您的帮助.圣诞快乐!
解决方法
我建议:
a.sliderImg { color: transparent; }
您还可以使用用户选择的CSS属性来阻止选择文本:
a.sliderImg { color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none; }
或者,可能使用元素本身的不可选属性:
<a unselectable="on" class="sliderImg" href="04.jpg">whatever</a>
顺便提一下,你的HTML格式不正确,/不应该在开始标记中(这只是在void元素的开始标记中,例如input或img).
参考文献:
> user-select
.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。