Home Ask Login Register

Developers Planet

Your answer is one click away!

alex_01573 February 2016

Using .toggle() causes problems

I'm trying to make a show/hide button and I can't manage to get it working. What I want to do is when the user clicks the button, some content will appear. Also, it has to be possible to hide the content if the show/hide button is pressed again.

I came up wiith this:

<center><input type='button' id='hideshow' class='myButton' value='Show/Hide'></center>

<div id="content1" style="display: none;">
<!-- some content -->

I read it over and over again, but I still can't figure it out. What did I do wrong?


Fri Day February 2016

You didn't use the id.

you just did ("hideshow") and ("content1") instead of ("#hideshow") and ("#content1")

if you do ("p") it doesn't to the id "p" it does


but if you do ("hideshow"), it does


that doesn't exist

Post Status

Asked in February 2016
Viewed 2,709 times
Voted 10
Answered 1 times


Leave an answer

Quote of the day: live life