How to access the value after pay now $
in the tag with id payment-sub-btn
in the code below to payModal() function I have finalPrice variable finalPrice = document.getElementById('payment-sub-btn').textContent;
I try using by getting element by id but it says NaN
probably cause its getting the text as well pay now $
with it is there any way to just get the value which is integer value and no text along with it?
<div class="modal-body" style="background-color: #F6F9FC">
{{-- Display a Payment Form --}}
<form method="post" id="payment-form" class="m-1" data-secret="123">
<div class="card-element-hide form-group col-md-12">
<div id="payment-element" class="w3-block" style="min-width:300px!important">
<!-- Mount the Payment Element here -->
</div>
</div>
<div id="coupon-details" class="col-md-12">
<label class="stripeFontStyle" for="feCoupon"> Coupon Code </label>
<input type="text" class="form-control form-control-sm stripeBoxStyle" id="lost_coupon"
onChange="checkCoupon()" name="lost_coupon" data-dpmaxz-eid="10">
<p style="visibility:hidden; margin-left:5px;" id="couponMessage"></p>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary boxShadow" data-dismiss="modal"><i class="fa-solid fa-circle-xmark"></i>
Close</button>
<button id="payment-sub-btn" class="btn btn-success float-right" style="background-color:#28a745!important"
onclick="update_coupon();">Pay Now $</button>
</form>
</div>
<script>
async function payModal() {
await fetch("{{ route('paymentModal') }}")
.then(response => response.json())
.then(response => {
const form = document.getElementById('payment-form');
_key_for_ss = response.paymentIntent.client_secret;
paymentIntentID = response.paymentIntent.id;
finalPrice = document.getElementById('payment-sub-btn').textContent;
async function openModal() {
await createCard();
$('#pay-modal').modal('show');
}
openModal();
})
}
var counts = 1;
var checkboxes;
var finalPri;
function add_to_download_entries(data) {
checkboxes = document.querySelectorAll('input[name="checkWills"]:checked');
counts = checkboxes.length;
if($.inArray(data, selected_lostwill_array) >= 0){
selected_lostwill_array = $.grep(selected_lostwill_array, function(value){
return value != data;
});
}else{
selected_lostwill_array.push(data);
}
// DataTables Functions
$(document).ready( function () {
$('#org_lost_table').DataTable();
$('#all_lost_table').DataTable();
if(counts>0){
finalPri = "Pay Now $" + Number(counts) * Number(22);
$( "#payment-sub-btn" ).text(finalPri);
}else $( "#payment-sub-btn" ).text(0);
} );
}
</script>