I'm a beginner in Jquery and I have the following question.
I have div
and ul
with several li
.
The ul
is as display:none
, I want to trigger display:block
when I click on the div. As below:
<div class="divTitulo">Residencial</div>
<ul class="ulDisplayNone">
<li class="liDisplayNone">item1</li>
<li class="liDisplayNone">item1</li>
<li class="liDisplayNone">item1</li>
<li class="liDisplayNone">item1</li>
<li class="liDisplayNone">item1</li>
<li class="liDisplayNone">item1</li>
<li class="liDisplayNone">item1</li>
</ul>
The script I made, looks like this:
<script>
$( ".divTitulo" ).click(function() {
$(".ulDisplayNone").css("display:block");
});
</script>
It's not working, what did I do wrong?
But how do I hide the div I've activated?
I tried
else
$(this).next('ul').hide();
I do not know if the syntax is correct.