My HTML:
<input id="penge" />
<input type="button" onclick="javascript: paymentwindow.open()" value="BETAL" id="betal" />
My jQuery:
<script type="text/javascript">
$(document).ready(function(){
var penge = $("#penge").val();
paymentwindow = new PaymentWindow({
'amount': penge,
'currency': "DKK",
'language': "1",
'orderid': "155",
'callbackurl': "http://localhost:3000/"
});
});
</script>
The variable is undefined. I want to set the variable penge when the betal button is clicked.
UPDATE:
<script type="text/javascript">
$(document).ready(function(){
var penge;
$('#betal').click(function(){
penge = $("#penge").val();
paymentwindow.open();
});
paymentwindow = new PaymentWindow({
'amount': penge,
'currency': "DKK",
'language': "1",
'orderid': "155",
'callbackurl': "http://localhost:3000/"
});
});
</script>
Penge is undefined. I have also removed the onclick js for the betal button.
typeof your input?text...