Michael Cripps
asked on
Show hide HTML Div based on PHP variable, using javascript
Need to show or hide a DIV with Javascript based off of PHP string variable. Basically, I have a DIV with a lot of information and do not want to show it on the page, if the information supplier with the PHP script has not values. I am testing the value by setting a php variable and want to use javascript to see if there is a string in the php variable and if so, show the div. If the string is empty or blank, then hide the DIV.
Do you know the string variable that you want to see returned?
why not using PHP directly ?
old school :
old school :
<?php
if(!empty(thestring)) {
?>
<div>WE SHOW THE DIV</div>
<div>WE SHOW THE DIV</div>
<div>WE SHOW THE DIV</div>
<div>WE SHOW THE DIV</div>
<div>WE SHOW THE DIV</div>
<div>WE SHOW THE DIV</div>
<div>WE SHOW THE DIV</div>
<div>WE SHOW THE DIV</div>
<div>WE SHOW THE DIV</div>
<?php
}
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nice job. Worked perfectly.