Edit in JSFiddle

//Testing error handlers! See below.
//We create and error handler:
onerror = unhandled;
function unhandled(msg, url, line) {
    alert('There has been an unhandled exception: ' + msg + ', see line: ' + line);
//This will add the values together as text attaching the first character to the next:
function add() {
    alert($("#int1").val() + $("#int2").val());
//This will parse the value to a number and then add them as numbers:
function addWithParseInt() {
    alert(parseInt($("#int1").val()) + parseInt($("#int2").val()));
function divide() {
    if(isNaN($("#int1").val()) || isNaN($("#int2").val())) {
        throw('One or more values are non-numeric');
    alert($("#int1").val() / $("#int2").val());
Integer 1: <input type="text" id="int1" /><br/>
Integer 2: <input type="text" id="int2" /><br/>
<input type="button" name="add" value="Add" onclick="add();" />
<input type="button" name="divide" value="Divide" onclick="divide();" />
<input type="button" name="parse_add" value="Parse and add" onclick="addWithParseInt();" />