dimanche 4 mars 2018

jQuery input change doesn't work

I'm trying to make something like a shopping cart, but just with an order form. I am using this pattern to fire input changes, but it doesn't work in my case.

Here what I have first.

<div class="ingrid__table-row">
   <div class="ingrid__table-data ingrid__table-item">Lemon</div>
   <div class="ingrid__table-data ingrid__table-weight">15g</div>
   <div class="ingrid__table-data ingrid__table-price">10</div>
</div>

With jQuery, on click, I take the data from ingrid__table-data and add to the suitable input into .order__container.

Then, on the same click, a number input is appended, which will enable to choose the quantity of the selected products.

$('.order__container').append(`<input class="bul-order-info__input bul-order-info__qnt" type="number" name="Quantity" min="1" value="1">`)

And it appears on a webpage in the order form.

I need to detect the value changes of "number type input" and fire other events. But the input changes are not detected, although if I create the same input element manually in HTML document, these changes are detected perfectly as it's shown here

How can I achieve this behavior?

Aucun commentaire:

Enregistrer un commentaire