Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide span using jQuery

Tags:

html

jquery

hide

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>
like image 695
AJSwift Avatar asked Dec 27 '22 10:12

AJSwift


1 Answers

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

$(function() {
    $('span.website').hide();
});
like image 152
Pastor Bones Avatar answered Jan 12 '23 02:01

Pastor Bones