H
H
hyipojer2021-06-07 22:04:41
JavaScript
hyipojer, 2021-06-07 22:04:41

How to write code so that the number of cards is equal to the value in the list when clicked?

<section class="memory-game memory-game-hidden">

      <div class="memory-card" data-framework="BELKA">
         <img class="front-face" src="img/BELKA.jpg" alt="BELKA">
         <img class="back-face" src="img/card-game.svg" alt="Memory Card">
      </div>

      <div class="memory-card" data-framework="BELKA">
         <img class="front-face" src="img/BELKA.jpg" alt="BELKA">
         <img class="back-face" src="img/card-game.svg" alt="Memory Card">
      </div>

      <div class="memory-card" data-framework="CHEREPAHA">
         <img class="front-face" src="img/CHEREPAHA.jpg" alt="CHEREPAHA">
         <img class="back-face" src="img/card-game.svg" alt="Memory Card">
      </div>

      <div class="memory-card" data-framework="CHEREPAHA">
         <img class="front-face" src="img/CHEREPAHA.jpg" alt="CHEREPAHA">
         <img class="back-face" src="img/card-game.svg" alt="Memory Card">
      </div>

...еще несколько карточек


<div class="counter-info">
            <span class="count">Выбери количество карточек</span>
               <ul class="counter-row">
                  <li value="6"> 6 </li>
                  <li value="10"> 10 </li>
                  <li value="14"> 14 </li>
                  <li value="18"> 18 </li>
               </ul>
         </div>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Egor Kharlamov, 2021-06-08
@madbaddad

Greetings!
1) In the click handler, we get the value of the value attribute .
2) Create DOM elements in a loop and append them to an element with a section tag ( https://www.javascripttutorial.net/dom/manipulatin... )

H
hyipojer, 2021-06-08
@hyipojer

Egor Kharlamov @madbaddad
hyipojer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question