I am using JQuery to add mask to the cpf field when the user is doing a search. However the masquerade is only enabled after making a submit on the page (clicking the search button).
<html>
<head>
<title> </title>
<script type="text/javascript" src="../style/scrpit.js"></script>
<script type="text/javascript" src="../style/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="../style/jquery.maskedinput.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#cpf").mask("999.999.999-99");
});
</script>
</head>
<body>
<div class="form-group col-md-5">
<input type="text" name="cpf" class="form-control" placeholder="CPF" id="cpf" required/>
</div>
<div class="form-group col-md-5">
<button type="submit" class="btn btn-primary btn-sm" value="Pesquisar" name="Pesquisar">Pesquisar</button>
</div>
</body>
</html>