使用jQuery隐藏span

时间:2011-11-30 04:03:08

标签: jquery hide html

如果没有文本,即使已经有嵌入的图像,如何隐藏跨度? 基本上每个跨度都有这样的嵌入式web图标和视频图标..

访问网站(webicon)观看视频(videoicon) 所以如果----没有链接文字---(EMBEDDED 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" />
     &nbsp;&nbsp;
     <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>

1 个答案:

答案 0 :(得分:10)

这将使用“网站”类隐藏所有span元素:

$(function() {
    $('span.website').hide();
});