Basic HTML hide?

Associate
Joined
1 Sep 2005
Posts
724
Hi

Got this running:

##DISTANCE=&quot; (#mile miles)&quot;##<br />
<a href="$$Web$$" target="_blank">More Information</a>

How would i not add the link more information if $$Web$$ is empty?

thanks
 
Going to need some more information. Is the HTML dynamically generated server side? If yes, then what language are you using?

Failing that then you could use javascript (jQuery). Start by giving your anchor an id (myID for sake of this example)

Code:
var myUrl = $("#myId").attr("href");
myUrl.length ? myUrl.show() : myUrl.hide();
 
System is UI based with a option to insert HTML in to create the above automated link. Code is generated by python i think..

I was trying to do it without using JS as i was not sure it would take script tags but looks like it will take a script tag in the box (not properly tested until i get time today and going to try do it as you suggested.

Thanks for the reply
 
Last edited:
PHP no good?

Code:
pseudocode

if whatever_url is not empty then $web = whatever_url
else $web = ''

Code:
<a href="<?php echo $web; ?>" target="_blank">More Information</a>
 
If all else fails you can always do a javascript function to check that value and if it's zero, just set the Visibility to hidden on the style. Run the javascript on the page load event.

edit- pretty much what redeye said if I'd read it correctly first time ^^
 
Last edited:
Back
Top Bottom