thanks a lot to the community for so much things I have learned here. So here is my first own question:
I need to set a step value for an input field ( input[title="Menge"] ) in a html table. The value must be taken from another table-column in the same row ( dd.variation-Verpackung p ) (There are different step values in each table row)
Here is my html:
<tbody>
<tr class="cart_item">
<td class="product-name">
<a href="/products/druckluftarmaturen/kegeltuelle-mit-o-ring-dichtung/?attribute_pa_hose-id=6-mm&attribute_pa_cone=13&attribute_pa_package=10">Kegeltülle DIN 20033 mit O-Ring Dichtung </a>
<div class="cat">Druckluftarmaturen</div>
<dl class="variation">
<dt class="variation-HoseID">Hose ID:</dt>
<dd class="variation-HoseID"><p>6 mm</p></dd>
<dt class="variation-Cone">Cone:</dt>
<dd class="variation-Cone"><p>1:3</p></dd>
<dt class="variation-Verpackung">Verpackung:</dt>
<dd class="variation-Verpackung">
<p>10</p>
</dd>
</dl>
<dl class="variation">
<dt>Bestell-Nr.</dt>
<dd>034-0006v</dd>
</dl>
</td>
<td class="product-quantity">
<div class="quantity">
<label class="screen-reader-text" for="">Anzahl</label>
<input type="number" id="" class="" step="1" min="0" max="" name="cart[11c4b4d2c3c1a853d0f4d2c31573e914][qty]" value="11" title="Menge" size="4" placeholder="" inputmode="">
</div>
</td>
<td class="product-remove">
<a href="/anfrageliste/?remove_item=11c4b4d2c3c1a853d0f4d2c31573e914&_wpnonce=e47b3633ba" class="remove" title="Dieses Produkt entfernen">×</a>
</td>
</tr>
<tr class="cart_item">
<td class="product-name">
<a href="/products/druckluftarmaturen/kegeltuelle-mit-o-ring-dichtung/?attribute_pa_hose-id=6-mm&attribute_pa_cone=13&attribute_pa_package=10">Kegeltülle DIN 20033 mit O-Ring Dichtung </a>
<div class="cat">Druckluftarmaturen</div>
<dl class="variation">
<dt class="variation-HoseID">Hose ID:</dt>
<dd class="variation-HoseID"><p>6 mm</p></dd>
<dt class="variation-Cone">Cone:</dt>
<dd class="variation-Cone"><p>1:3</p></dd>
<dt class="variation-Verpackung">Verpackung:</dt>
<dd class="variation-Verpackung">
<p>1</p>
</dd>
</dl>
<dl class="variation">
<dt>Bestell-Nr.</dt>
<dd>034-0006v</dd>
</dl>
</td>
<td class="product-quantity">
<div class="quantity">
<label class="screen-reader-text" for="">Anzahl</label>
<input type="number" id="" class="" step="1" min="0" max="" name="cart[11c4b4d2c3c1a853d0f4d2c31573e914][qty]" value="11" title="Menge" size="4" placeholder="" inputmode="">
</div>
</td>
<td class="product-remove">
<a href="/anfrageliste/?remove_item=11c4b4d2c3c1a853d0f4d2c31573e914&_wpnonce=e47b3633ba" class="remove" title="Dieses Produkt entfernen">×</a>
</td>
</tr>
</tbody>
Here is my jQuery :
jQuery( document ).ready(function() {
var vpc = jQuery(".woocommerce-cart .quantity input").closest(".cart_item").find("dd.variation-Verpackung p").html();
jQuery(this).closest(".woocommerce-cart .quantity input").attr('step', vpc);
});
What I am doing wrong?
Best regards and thanks for your help Pascal