Inability to click and select data created with Ajax

I create the product’s information and variations with Ajax, but it is not possible to click on the variations, what could be the reason?

<form>
    <div class="form-group">
        <p class="mb-5">
            Size: <strong><span id="sizeCaption">--</span> US</strong>
        </p>
        <div id="item_variation_size" class="mb-2"></div>
        <div class="form-row mb-7">
            <div class="col-12 col-lg">
                <button type="button" class="btn btn-block btn-dark mb-2 addToCart">Add to Cart <i class="fe fe-shopping-cart ml-2"></i></button>
            </div>
        </div>
    </div>
</form>

Ajax:

(async () => {
    const itemData = await submitSender(null, "getItemData", itemID, "post");
    if (itemData) {
        if (itemData.item.v) {
            for (var i = 0; i < itemData.item.v.variationData.sizes.length; i++) {
                document.getElementById("item_variation_size").innerHTML +=
                    '<div class="custom-control custom-control-inline custom-control-size mb-2"><input type="radio" class="custom-control-input" name="sizeRadio" id="sizeRadio_' +
                    itemData.item.v.variationData.sizes +
                    '" value="' +
                    itemData.item.v.variationData.sizes[i] +
                    '" data-toggle="form-caption" data-target="#sizeCaption"><label class="custom-control-label" for="sizeRadio_' +
                    itemData.item.v.variationData.sizes[i] +
                    '">' +
                    itemData.item.v.variationData.sizes[i] +
                    "</label>";
            }
        }
    }
})();

Could data-toggle="form-caption" data-target="#sizeCaption" be the reason why the variation uploaded and created with Ajax doesn’t work?

I think it would help if we could see your entire project. I feel like we are missing some information to help you properly.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.