I have this code:
<div class="cc-selector col-md-3">
<form method="POST" action="<?php echo base_url() . 'home/cart_finish/go'; ?>" class="checkout-form">
<input type="hidden" name="payment_type" value="omise">
<script src="https://cdn.omise.co/omise.js.gz"
data-key="<?php echo $omise_public_key_test; ?>"
data-image=" "
data-frame-label="Acme"
data-button-label="<?php echo translate('pay_now');?>"
data-submit-label="<?php echo translate('submit');?>"
data-location="no"
data-amount=" "
data-currency="us"
>
var total = $('#grand').html();
$("[data-amount]").attr('data-amount', total);
</script>
</form>
I want to set a value to the "data-amount" attribute. I tried with the above code, but it doesn't work.
Note: Omise is a payment gateway similar to Stripe. That code will render a pay button. I have to had the data-amount set before its render. That's why I cannot wait for the $document to be ready. I hope it makes sense.
srcattribute are not evaluatedsrcattribute specified, it should not have a script embedded inside its tags.data-*attribute at<script>element?phprelated to Question?