I've done a lot of searching about this and I've tried pretty much everything that has been suggested to no effect.
I have 2 series of radio buttons (only publishing one series):
<div class='place PP'>
<input type='radio' name='hotel' class='hotel' value='Natura Cabana Boutique Hotel' required>
Natura Cabana Boutique Hotel (24.300 DKK)
<input type='hidden' name='hotelPrice' class='Natura Cabana Boutique Hotel' value='24.300'>
</div>
<div class='place PP'>
<input type='radio' name='hotel' class='hotel' value='Casa Maravilla' required>
Casa Maravilla (42.500 DKK)
<input type='hidden' name='hotelPrice' class='Casa Maravilla' value='42.500'>
</div>
<div class='place PP'>
<input type='radio' name='hotel' class='hotel' value='Casa Veintiuno' required>
Casa Veintiuno (31.500 DKK)
<input type='hidden' name='hotelPrice' class='Casa Veintiuno' value='31.500'>
</div>
The value and the price are retrieved from a database.
My jQuery code to show the price looks like this:
$(".hotel").change(function() {
var hotel = $(this).val();
switch (hotel) {
case "Natura Cabana Boutique Hotel":
var x = new Number(24.300);
$("#price").val(x.toFixed(3) + " DKK");
break;
case "Casa Maravilla":
var x = new Number(42.500);
$("#price").val(x.toFixed(3) + " DKK");
break;
case "Casa Veintiuno":
var x = new Number(31.500);
$("#price").val(x.toFixed(3) + " DKK");
break;
// more jQuery code
} });
How can I pass 2 values and replace the fixed numbers I used with the value of $hotelPrice?
Thanks a lot.