function isPhoneNo(phone) {
var pattern = /^1[34578]\d{9}$/;
return pattern.test(phone);
}
<input type="text" class="form-control" id="tableName" placeholder="请输入手机号" data-toggle="tooltip" data-placement="top">
<script>
function showPopover(target, msg) {
target.attr("data-original-title", msg);
$('[data-toggle="tooltip"]').tooltip();
target.tooltip('show');
target.focus();
var id = setTimeout(
function () {
target.attr("data-original-title", "");
target.tooltip('hide');
}, 2000
);
}
if(!isPhoneNo(phoneNum)){
showPopover($("#tableName"),"请输入正确的手机号");
}
</script>