herghost Posted May 28, 2011 Share Posted May 28, 2011 is there a very simple way of showing a div which has the css hidden property? Basically I just want to show a div called error when a username and password is entered incorrectly (php) Cheers Dave Quote Link to comment https://forums.phpfreaks.com/topic/237714-show-div/ Share on other sites More sharing options...
hemo-ali Posted May 28, 2011 Share Posted May 28, 2011 php no should use js for showing or jquery Quote Link to comment https://forums.phpfreaks.com/topic/237714-show-div/#findComment-1221591 Share on other sites More sharing options...
herghost Posted May 28, 2011 Author Share Posted May 28, 2011 php no should use js for showing or jquery ehm..... I just want a simple line of javascript for showing a div? Quote Link to comment https://forums.phpfreaks.com/topic/237714-show-div/#findComment-1221594 Share on other sites More sharing options...
mikesta707 Posted May 28, 2011 Share Posted May 28, 2011 just use javascript to set the visibility style to something other than hidden? Quote Link to comment https://forums.phpfreaks.com/topic/237714-show-div/#findComment-1221703 Share on other sites More sharing options...
herghost Posted May 28, 2011 Author Share Posted May 28, 2011 Thats what I am after yes! However js to me is gobbledegoop Quote Link to comment https://forums.phpfreaks.com/topic/237714-show-div/#findComment-1221707 Share on other sites More sharing options...
mikesta707 Posted May 28, 2011 Share Posted May 28, 2011 Well can/are you using Jquery or do you have to do this with pure javascript. Either way, i would do a google search on Javascript and the HTML DOM, and read a few tutorials on the subject before you get started on this Quote Link to comment https://forums.phpfreaks.com/topic/237714-show-div/#findComment-1221714 Share on other sites More sharing options...
herghost Posted May 28, 2011 Author Share Posted May 28, 2011 I have been looking at jquery, and I though this would do it, but no luck else { echo "<script>$('#oops').show()</script>"; } Quote Link to comment https://forums.phpfreaks.com/topic/237714-show-div/#findComment-1221723 Share on other sites More sharing options...
arbitter Posted May 29, 2011 Share Posted May 29, 2011 Well, say you have a div called 'Showme' that's hidden and a button to show it. here's the code so you can use it on many elements wth different id's: <script type='text/javascript'> function hideShow(div){ if(document.getElementById(div).style.visibility == 'hidden'){ document.getElementById(div).style.visibility = 'visible'; }else{ document.getElementById(div).style.visibility = 'hidden'; } } </script> <input type='button' onclick="hideShow('Showme');" /> <div id='Showme' style='visibility:hidden'>I am hidden untill you press the button above. I get hidden again after pressing it another time.</div> Quote Link to comment https://forums.phpfreaks.com/topic/237714-show-div/#findComment-1221803 Share on other sites More sharing options...
herghost Posted May 29, 2011 Author Share Posted May 29, 2011 Thanks arbitter, I got it working, I realised that I was calling the script before including jquery Quote Link to comment https://forums.phpfreaks.com/topic/237714-show-div/#findComment-1221837 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.