Below function will return up to IE 10
function IE(v) {
return RegExp('msie' + (!isNaN(v)?('\\s'+v):''), 'i').test(navigator.userAgent);
}
and for IE 11 follow the below method
if(navigator.userAgent.indexOf("rv:11")>0 && navigator.userAgent.indexOf("Trident")>0)
{
alert("IE 11")
}