<input type="tel" value="num" oninput="num.replace(/[^\d]/g,'')" /> <input type="text" value="num" oninput="num=num?num.replace(/[^\d]/g,''):''" />