Snooble Posted May 31, 2007 Share Posted May 31, 2007 I know this is not .php, most probably Javascript. but... I want to hide code onclick. So i have a bit of code: <?php echo 'yes yes yes'; ?> When a user clicks a button it hides that code. then click it again and it reveals it, without changing page. If i can't hide php, then what about just html? It's done on ebay, where you can click a cross on "my account" page and it hides the box with the X you pressed. Any ideas? I know NOTHING about javascript. Snooble Link to comment https://forums.phpfreaks.com/topic/53704-hiding-code-immeadiatly/ Share on other sites More sharing options...
Daniel0 Posted May 31, 2007 Share Posted May 31, 2007 <script type="text/javascript"> function hide(container_id) { document.getElementById(container_id).style.display='none'; } </script> <div id="some_text">bla bla bla</div> <button type="button" onclick="hide('some_text');">Hide the above text</button> Link to comment https://forums.phpfreaks.com/topic/53704-hiding-code-immeadiatly/#findComment-265425 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.