1
ラジオボタンをトリガーする際にボタンの値を変更しようとしています。この小さなスクリプトを使用することによりFieldset .change jQuery
<fieldset id="product-color">
<input type="radio" id="red" name="color" value="Red">
<label for="red">Red</label><br>
<input type="radio" id="blue" name="color" value="Blue">
<label for="blue">Blue</label><br>
</fieldset>
<button
id="order-button"
data-item-id="1"
data-item-name="Shirt"
data-item-price="20"
data-item-custom2-name="Color"
data-item-custom2-options="Red|Blue">
Add Item
</button>
:それはかなりうまく動作選択・入力フィールドで
$('#product-color').change(function() {
$('#order-button').data('item-custom2-value', $(this).val());
});
ではなく、フィールドセットを持ちます。違いはありますか?
OPはあなたがボタンの上に値を変更したいイベントビットは不明ですクリックまたはラジオボタンの変更。また、フィールドセットのデータ値として割り当てる値は? – guradio