Skip to content

Commit

Permalink
adicionando validacao para numero a e b
Browse files Browse the repository at this point in the history
  • Loading branch information
ti24horas committed Oct 3, 2012
1 parent a547500 commit 78e55d2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion calculator.js
@@ -1,6 +1,14 @@
$("#calcular").click(function() {
var resultado;

regvalidation = /^[\d]+$/;
if (!regvalidation.test($("#num-a").text())){
alert('numero a invalido');
return false;
}
if (!regvalidation.test($("#num-b").text())){
alert ('numero b invalido');
return false;
}
var numA = parseInt($("#num-a").val());
var numB = parseInt($("#num-b").val());

Expand Down

0 comments on commit 78e55d2

Please sign in to comment.