0
I have the following html:
<p class="question"><span class="mark-question">1.</span> Relacione as fabricantes aos seus veículos</p>
<ul class="first-column">
<li class="ford" data-answer="0,5">Ford</li>
<li class="fiat" data-answer="2">Fiat</li>
<li class="renault" data-answer="3">Renault</li>
<li class="ferrari" data-answer="">Ferrari</li>
<li class="honda" data-answer="4">Honda</li>
<li class="chevrolet" data-answer="1">Chevrolet</li>
</ul>
<ul class="second-column">
<li class="edge">Edge</li>
<li class="onix">Ônix</li>
<li class="palio">Palio</li>
<li class="sandero">Sandero</li>
<li class="civic">Civic</li>
<li class="fusion">Fusion</li>
<li class="fusquinha">Fusquinha</li>
</ul>
I wanted to relate these lis through javascript. (Example: Make Honda belong to civic) I’m sorry if the doubt is stupid, but I haven’t been able to find an answer yet
what your intention with this?
– Henrique Santiago
Set the answers of the exercise to then be able to perform a function for when to click the wrong items and another for when to click the right ones. But for that, the lis have to be related
– Pedro Lucas Flor
did not understand yet, try to clarify more your doubt.
– Henrique Santiago
I want to define the answers for this little exercise that I’m putting together, and for that, I used the date parameter to be able to relate them to the other table. I wish I could point out to javascript that li "Honda" belongs to li "civic". In the case of the Honda date-swer is 4. I wanted to show for the program that that date-Swer belongs to the civic li. I clarified a little?
– Pedro Lucas Flor
It’s not clear enough, but from what I understand, you need to have a way to group the
<li>
s. Where appropriate, the<ul>
does this. Place an attributeid
in each<ul>
(ex:<ul id="marcas-de-carro">
) that you will be able to catch all the<li>
s by<ul>
father.– Alisson
So I don’t need the date parameter?
– Pedro Lucas Flor
By clicking on an item of the first <ul> what should happen ?
– GeekSilva
Nothing, only something should happen after he clicks on the first <ul> and then on the second.
– Pedro Lucas Flor