Нажатие кнопки количества прядильщиков в Shopify - PullRequest
0 голосов
/ 02 мая 2020

Я пытаюсь вызвать кнопку количества прядильщиков в моем магазине Shopify. По сути, я хочу установить максимальный предельный порядок 1. Ниже приведен код, я пытаюсь вызвать ввод с именем класса «cart__qty-input».

Я пытался $(".cart__qty-input:eq(0)").val(1).trigger('change');, но он только меняется значение, не вызывающее событие.

<td class="cart__quantity-td text-right small--hide">
                <div class="cart__qty">
                  <label for="updates_large_34113200128045:3d569029201ce7fd4affe9f95f790cb6" class="cart__qty-label" data-quantity-label-desktop="">Quantity</label>
                  <input id="updates_large_34113200128045:3d569029201ce7fd4affe9f95f790cb6" class="cart__qty-input" type="number" name="updates[]" value="3" min="0" pattern="[0-9]*" data-quantity-input="" data-quantity-item="1" data-quantity-input-desktop="">
                </div>
                <div class="cart__qty-error-message-wrapper cart__qty-error-message-wrapper--desktop hide" role="alert" data-cart-quantity-error-message-wrapper="">
                  <span class="visually-hidden">Error </span>
                  <svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-error" viewBox="0 0 14 14"><g fill="none" fill-rule="evenodd"><path d="M7 0a7 7 0 0 1 7 7 7 7 0 1 1-7-7z"></path><path class="icon-error__symbol" d="M6.328 8.396l-.252-5.4h1.836l-.24 5.4H6.328zM6.04 10.16c0-.528.432-.972.96-.972s.972.444.972.972c0 .516-.444.96-.972.96a.97.97 0 0 1-.96-.96z"></path></g></svg>
                  <span class="cart__qty-error-message" data-cart-quantity-error-message=""></span>
                </div>
              </td>

1 Ответ

0 голосов
/ 02 мая 2020

Я ценю вашу попытку решить эту проблему, но почему вы не можете установить максимальный лимит ввода, а не установить значение 1
проверить этот код

$('input-class-name').attr('max',1);

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...