4

Can anyone help me with checking availability of the mask. I use this one:

if ($.isFunction($("#ID").mask)){
    var val = $("#ID").mask();
} else {
    var val = document.getElementById(ID).value;
}

but this condition is always TRUE. Don't matter written with:

$(document).ready(function(){
  $("#ID").mask("8 (999) 999-9999");
}

or not.

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83

1 Answers1

6

If you're trying to verify if the .mask() function is available, you should try checking $.fn.mask.

If you're trying to verify whether an element has a mask, test if $("#element").data("rawMaskFn") is defined.

gustavohenke
  • 40,997
  • 14
  • 121
  • 129