Reputation: 21
I have the following structure on wordpress:
<form method="post" action="https://gateway.payulatam.com/ppp-web-gateway/pb.zul" accept-charset="UTF-8">
<...>
<input name="amount" type="hidden" value="5000.00"/>
<...>
</form>
I need to change the value of the input name amount dinamically..
I have a variable that displays my price:
<span class="tourmaster-tour-booking-bar-total-price">$1,745,000</span>
But the "tourmaster-tour-booking-bar-total-price" changes in some web pages.
I want to read the "tourmaster-tour-booking-bar-total-price" variable and give this variable to the 'value' in my input amount.
Thank you very much!
I've been struggling with this. Please take a moment to help me, I'll appreciate
Upvotes: 0
Views: 50
Reputation: 64
You can do this easily using jquery!
$(document).ready(function() {
var formPrice = $('.tourmaster-tour-booking-bar-total-price').html().replace(/[$,]/g, '');
$('form #input-price').val(formPrice);
});
Upvotes: 1