I have this script from fiddle:
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
$('#qty').keyup(function(){
if($(this).val() != '' && isNumber($(this).val()) && $(this).val() > 0)
{
var price = $('#real_price').val() * 1;
var qty = $(this).val() * 1;
var total = price * qty;
$('#price').html(total);
}
else
{
$('#price').html(price);
}
});
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
</script>
</head>
<body>
Price $<span id="price">500</span>
<input type="hidden" id="real_price" value="500" />
<input type="text" id="qty" value="1"/>
</body>
</html>
On fiddle it works, for me doesn't.
I've tried to add more quantities but it doesn't update the price. What could be the problem?