Display block with Onclick

Asked

Viewed 3,504 times

2

Hello,

I do not know mecher a lot with javascript and needed help, I would like to make a menu that when clicked change the display of a display div:None to display:block.

My menu

            <div id="back">
                <ul>
                    <li class="li1"><a href="#">O que é?</a></li>
                    <li><a href="#">Objetivo</a></li>
                    <li><a href="#">Pré-requisitos</a></li>
                    <li><a href="#">Público-alvo</a></li>
                    <li><a href="#">Metodologia</a></li>
                    <li><a href="#">Conteúdo</a></li>
                    <li><a href="#">Professores</a></li>
                </ul>
            </div>  
test
  • 1

    Dude, I don’t really understand what you want but I’ve created a very simple example to do using jquery. Abs http://jsfiddle.net/claudioromano13/h1c1rkcd/

1 answer

3


Try the following Javascript:

<script>
function exibeDiv(){
var div = document.getElementById("back");
div.style.display = "block";
}
</script>

Html:

<div id='back' onclick='exibeDiv()'>
</div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.