0
Hello personal I need to display a text that is in a certain div in a listing that I did the problem that the div and the class have the same name, for example below.
<div class="item" id="faq">
<div class="title"><b>Ola titulo todos</b></div>
<div class="text" style="display:none;">Teste de mensagem todos</div>
</div>
<div class="item" id="faq">
<div class="title"><b>Ola titulo todos</b></div>
<div class="text" style="display:none;">Teste de mensagem todos</div>
</div>
<div class="item" id="faq">
<div class="title"><b>Ola titulo todos</b></div>
<div class="text" style="display:none;">Teste de mensagem todos</div>
</div>
Semantically, the ID of a tag should always be unique. Classes can be repeated. Otherwise you won’t be able to know which tag the texts are being displayed in.
– Andrew Ribeiro
and if id is different? how would you do?
– gezer
would have to pass the correct id?
– gezer
If id is different, example:
<div id="faq1">...</div><div id="faq2">...</div>
you could use aJQuery
selector normally:$("#faq1").html()
.– Andrew Ribeiro
how would you do that friend?
– gezer
How would you do what? I put in the example:
$("#faq1").html()
. In that case if you give oneconsole.log($("#faq1").html());
your return will be:<div class="title"><b>Ola titulo todos</b></div>
 <div class="text">Teste de mensagem todos</div>
is not just what you want?– Andrew Ribeiro
I changed the code above I think that now you would understand for example the div she this style="display:None;" do not show and I want to click on Faq it shows that text that is hidden.
– gezer
I’ve decided thanks already friend.
– gezer