0
I am trying to implement a mask and validate the email field using the plugin inputmask unsuccessfully the mask does not appear and consequently does not validate, why ?
That is the code:
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script src='<%= Page.ResolveUrl("~/jquery-3.3.1.min.js") %>'></script>
<script src='<%= Page.ResolveUrl("~/scripts/inputmask/jquery.inputmask.js") %>'></script>
<script type="text/javascript">
(function ($) {
$(function () {
$('#txtEmail').inputmask({
mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,6}][.*{1,2}]",
greedy: false,
onBeforePaste: function (pastedValue, opts) {
pastedValue = pastedValue.toLowerCase();
return pastedValue.replace("mailto:", "");
},
definitions: {
'*': {
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
casing: "lower"
}
}
});
});
})(jQuery);
</script>
<div class="col-md-8">
<label for="txtEmail" class="font-weight-bold">Email</label>
<asp:TextBox ID="txtEmail" runat="server" class="form-control" MaxLength="50" ToolTip="Digite o Email" ClientIDMode="Static"></asp:TextBox>
</div>
</asp:Content>
Error
Uncaught TypeError: Inputmask is not a constructor
at w.fn.init.$.fn.inputmask (jquery.inputmask.js:76)
at HTMLDocument.<anonymous> (CadUsuario.aspx?idusuario=7:259)
at l (VM792 jquery-3.3.1.min.js:2)
at c (VM792 jquery-3.3.1.min.js:2)
Change the file
jquery.inputmask.js
forjquery.inputmask.bundle.js
– Jorge.M
And what do you mean by email mask? when the script should know it needs to insert a
@
or a.
– Leandro Angelo
@leandro Angelo insert a @
– hard123
@Jorge. M downloaded jqu3ry.inputmask from Nuget and there is no such file as jquery.input.Bundle.js, the name of this file is correct ?
– hard123