使用 jQuery 隐藏跨度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8320989/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Hide span using jQuery
提问by AJSwift
How to hide span if there is no text even though there already is an embedded image? Basically there are little web icon and video icon embedded like this in each span..
即使已经有嵌入的图像,如果没有文本,如何隐藏跨度?基本上,每个跨度中都嵌入了很少的网络图标和视频图标。
Visit website(webicon) View Video(videoicon) so if ----no link text---(EMBEDDED WEBICON), the whole thing including the image icon should hide..
访问网站(webicon)查看视频(videoicon)所以如果----没有链接文本---(嵌入式WEBICON),包括图像图标在内的整个内容都应该隐藏..
<div class="profile-links">
<!--visit website,watch video links-->
<span class="website"><SharePointWebControls:UrlField FieldName="VISIT WEBSITE" runat="server">
</SharePointWebControls:UrlField></span> <img class="website" src="/Style Library/Images/design/icons/icon-www.png" alt="WebSite" />
<span class="video"><SharePointWebControls:UrlField FieldName="WATCH VIDEO" runat="server">
</SharePointWebControls:UrlField></span><img src="/Style Library/Images/design/icons/icon-video-teal.png" alt="Video" />
</div>
回答by Pastor Bones
This will hide all of the span elements with a class of 'website':
这将隐藏所有具有“网站”类的跨度元素:
$(function() {
$('span.website').hide();
});