Question: I am in need to validate phone number & email address in same input field that if user enters letters then it should be show email validation & if user tries to enter phone number it should show the phone number validation. Please help on this issue. I am using bootstrap validator from this <http://1000hz.github.io/bootstrap-validator/>

Answer: 
Sounds like the above answer is good, but wanted to pass along my response as well. Looks like the same but may have more robust phone number handling.Also demos jquery form submit event handling which is a pattern I prefer.
<https://jsfiddle.net/joedonahue/8vasb4nu/9/>

```
<!--HTML-->
<form id="myform" name="myform" action="/echo/html/" method="post">
    <input type="text" id="myinput" name="myinput" />
    <input type="submit" value="submit" />
</form> 

<!--JavaScript-->    

/* Get Values */
var i1 = $("#myinput");

/* Map Event Handler */
$("#myform").on("submit",validate);

/* Validate Function */
function validate(){

    /* Phone Test */
    var filter = /^((\+[1-9]{1,4}[ \-]*)|(\([0-9]{2,3}\)[ \-]*)|([0-9]{2,4})[ \-]*)*?[0-9]{3,4}?[ \-]*[0-9]{3,4}?$/;
    if (filter.test(i1.val())) {
        alert("true!");
        return true;
    }

    /* Email Test */
    var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    if (filter.test(i1.val())) {
        alert("true!");
        return true;
    }

    alert("false!");
    return false;
}

```
Email and phone validation using jquery..**[DEMO](https://jsfiddle.net/sheshu036/h4m311cL/2/)**

```
$('#sub').click(function(){
var ep_emailval = $('#email').val();
console.log(ep_emailval);
    var intRegex = /[0-9 -()+]+$/;

if(intRegex.test(ep_emailval)) {
   console.log("is phone");
   if((ep_emailval.length < 9) || (!intRegex.test(ep_emailval)))
{
     alert('Please enter a valid phone number.');
     //return false;
}

}
    else
    {
 var eml = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;       
        console.log("is email");
        if (eml.test(ep_emailval) == false) {
    alert("Please enter valid email address.");
   // $("#<%=txtEmail.ClientID %>").focus();
    //return false;
 }
    }
});

```