var getstockid = $.trim($("#SearchString").val()); if (!isNaN(getstockid)) alert('是数字!'); else alert('不是数字!');