0
I am a beginner in Jquery and have the following question.
I own a div
and a ul
with several li
.
To ul
is as display:none
, want to trigger display:block
when I click 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, it was like this:
<script>
$( ".divTitulo" ).click(function() {
$(".ulDisplayNone").css("display:block");
});
</script>
It’s not working, what I did wrong?
But how do I hide the div I activated?
I tried to
else
$(this).next('ul').hide();
I don’t know if the syntax is correct.
Thank you friend. A question a bit like beginner. This script I put before div and ul? or can it be after? Would that be correct? <script> $(". productsMenuItensDiplay"). css({"display", "block"}); });</script>
– Felipe Viero Goulart
I’ll edit the answer with the full shape of how it would look.
– Diego Lopes Lima
Best guy, I did on Jsfiddle, if you can look: http://jsfiddle.net/felipestoker/5DfWU/
– Felipe Viero Goulart
Actually: http://jsfiddle.net/5DfWU/4/
– Diego Lopes Lima
You just modified the
script
?– Felipe Viero Goulart
No, I removed a Ode display where I didn’t need it...
– Diego Lopes Lima
Thanks Diego, it worked 100% :)
– Felipe Viero Goulart