This line:
var y=$("#text").val();
returns a string.
What you need to do is convert/coerce this result to a number using one of the following methods:
var y = parseInt($("#text").val(), 10);
var y = parseFloat($("#text").val()); // returns a floating point number
var y = Number($("#text").val());
var y = +$("#text").val();