用Javascript创建购物车

时间:2019-02-04 01:44:44

标签: javascript jquery html cart shopping-cart

我试图用javascript / jQuery创建购物车。我的问题是我的逻辑在代码中不起作用。查看我的代码。

from try import student

student1 = student("Jimmy", "Business", 3.1, False)
print(student1.name)

这是我的产品列表,我使用javascript尝试获取用户激活“ li”的元素。

C:\Users\User\PycharmProjects\test\venv\Scripts\python.exe C:/Users/User/PycharmProjects/test/try.py

Process finished with exit code 0

现在我有一个购物车,我不知道如何给变量。

<ul class="list-guides row">
          <li class="col-xl-4 col-lg-4 col-md-6 col-12">
            <div class="item">
              <a href="#" class="select">
                <img src="img/icon/icon_guia_competencias.png" width="146" height="206" alt="Competência Gerais na BNCC" class="img-fluid" />
              </a>
              <p class="title">Competência Gerais na BNCC</p>
              <p class="unit">Valor Unitário: R$17</p>
              <p class="subs">Assinantes: R$9.90</p>
              <div class="quantity">
                <button class="plus-btn add" type="button" name="button">+</button>
                <input type="text" name="number" value="1" class="number" />
                <button class="minus-btn add" type="button" name="button">-</button>
              </div>
            </div>
          </li>
          <li class="col-xl-4 col-lg-4 col-md-6 col-12">
            <div class="item">
              <a href="#" class="select">
                <img src="img/icon/icon_guia_infantil.png" width="146" height="206" alt="Educação Infantil na BNCC" class="img-fluid" />
              </a>
              <p class="title">Educação Infantil na BNCC</p>
              <p class="unit">Valor Unitário: R$17</p>
              <p class="subs">Assinantes: R$9.90</p>
              <div class="quantity">
                <button class="plus-btn add" type="button" name="button">+</button>
                <input type="text" name="number" value="1" class="number" />
                <button class="minus-btn add" type="button" name="button">-</button>
              </div>
            </div>
          </li>
          <li class="col-xl-4 col-lg-4 col-md-6 col-12">
            <div class="item">
              <a href="#" class="select">
                <img src="img/icon/icon_guia_linguaportuguesa.png" width="146" height="206" alt="Língua Portuguesa na BNCC" class="img-fluid" />
              </a>
              <p class="title">Língua Portuguesa na BNCC</p>
              <p class="unit">Valor Unitário: R$17</p>
              <p class="subs">Assinantes: R$9.90</p>
              <div class="quantity">
                <button class="plus-btn add" type="button" name="button">+</button>
                <input type="text" name="number" value="1" class="number" />
                <button class="minus-btn add" type="button" name="button">-</button>
              </div>
            </div>
          </li>
        </ul>

我如何解决这个问题?

0 个答案:

没有答案