<input type='text' id = 'phone' onchange='testPhone();'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
function testPhone() {
var phone = $("#phone").val();
if (/^79\d{9}$/.test(phone)) {
alert('Ok');
} else {
alert('Error');
};
}
</script>