1
I am studying javascript and jQuery and decided to make a simple page for validation of a data field. I used the plugin Masked input and limited the field to 10 characters. I am working with 3 files:
My index:
<html>
<head>
<title>Teste jquery data</title>
</head>
<meta charset="utf-8">
<script src="jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="jquery.maskedinputs.js" type="text/javascript"></script>
<script src="mascaras.js" type="text/javascript"></script>
<body>
<form method="POST" action="#">
<label>Data: </label>
<input type="form_text" name="data" maxlength=10 id="data">
<input type="submit" class="Enviar" name="data" >
</form>
</body>
And a file with the function to validate dates:
jQuery(function($)(
$("#data").mask("99/99/9999");
));
I read the other posts here in the OS and tried to apply the solutions that solved the problems of others, but in my case there is still something missing. the field simply does not insert "/" when I try to enter the date.
Why don’t you use datepicker for that? https://jqueryui.com/datepicker/
– Lodi
Thanks @Lodi For some reason, datepicker was the only thing that worked so far, although it takes a while to load the page.
– wes85melis
Anyway if you check the jQuery Masked Input repository you will see that the project has been dead for at least 4 years. Nor do the authors advise you to use them anymore, so it probably won’t even work with jQuery 3.3.1.
– fernandosavio