I have a situation. Sharepoint translates server side Linkfields to regular HTML tag during page rendering as follows: The first one is when some one enters value for Website field. Second one, content editor left it empty, so page rendered without anchor tag. Depending on whether RegisterLink contains an anchor tag or not, I should hide RegisterOrangeBtnHolder, if not tag.
This didn’t work: please help!
if ($($('.RegisterLink').length) <0){
$('.RegisterOrangeButton').hide();
}
<div class="RegisterBtnHolder">
<span class="RegisterOrangeButton">
<span class="RegisterLink">
<a href="http://www.google.com">Register Online</a>
</span>
</span>
</div>
<div class="RegisterBtnHolder">
<span class="RegisterOrangeButton">
<span class="RegisterLink">
</span>
</span>
</div>
jQuery has a wealth of selectors to simplify many filters
http://api.jquery.com/category/selectors/