0
I need to open the id="SUB_1"
when I click the <li id="B1">Botão 1</li>
and do the same when I click on <li id="B1">Botão 2</li>
open the id="SUB_1"
that this below the q button was clicked. And do the msm with the 3 too, but only with that jquery that I put at the end.
$(function(){
$(".Principal").click(function(){
$(this). ???
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ol class="Principal">
<li id="B1">Botão 1</li>
</ol>
<ol id="SUB_1">
<li id="A1">1</li>
<li id="A2">2</li>
<li id="A3">3</li>
</ol>
<ol class="Principal">
<li id="B1">Botão 2</li>
</ol>
<ol id="SUB_1">
<li id="A4">4</li>
<li id="A5">5</li>
<li id="A6">6</li>
</ol>
<ol class="Principal">
<li id="B1">Botão 3</li>
</ol>
<ol id="SUB_1">
<li id="A7">7</li>
<li id="A8">8</li>
<li id="A9">9</li>
</ol>
Some considerations: unlike classes, id is used for only one element. Thus, you should redesign button ids to B1, B2, B3, bx and list ids to Sub1, sub2, sub3, etc.
– Daniel Reis
In Jquery, Event Listener (click) could be relative to the id of the button clicked (e.g., #B1) instead of the parent class.
– Daniel Reis