AJSwift
AJSwift

Reputation: 719

Hide span using jQuery

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..

<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>

Upvotes: 6

Views: 34012

Answers (1)

Pastor Bones
Pastor Bones

Reputation: 7351

This will hide all of the span elements with a class of 'website':

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

Upvotes: 15

Related Questions