The script is in a file named: script.js and the code is:
- Code: Select all
var inicio=function () {
$(".cantidad").keyup(function(e){
if($(this).val()!=''){
if(e.keyCode==13){
var id=$(this).attr('data-id');
var precio=$(this).attr('data-precio');
$(this).parentsUntil('.producto').find('.subtotal').text('Subtotal: '+(precio*cantidad));
}
}
});
}
$(document).on('ready',inicio);
I call it from another file like this:
- Code: Select all
<html>
<head><title>Carrito - CiberPC</title>
<link href= "estilos.css" rel="stylesheet" type= "text/css">
[b]<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="script.js"></script>[/b]
</head>
<body>
etc....
Can you help me, guys? Thank you.