I have this in my javascript file but I do not know why it is not working in my fields.
$(document).ready(function () {
$("#number").mask('00000');
$("#open-hour").mask('00:00');
$("#close-hour").mask('00:00');
$("#date-foundation").mask('00/00/0000');
$("input[name=number]").mask("000000");
$("#cnpj").mask('00.000.000/0000-00');
$('#number-phone').blur(function () {
if ($(this).val().length == 15) { // Celular com 9 dígitos + 2 dígitos DDD e 4 da máscara
$('#number-phone').mask('(00) 00000-0009');
} else {
$('#number-phone').mask('(00) 0000-00009');
}
});
showHours();
showMenuPhones();
});
On my php page:
<script src="libs/assets/jquery-1.11.3.min.js"></script>
<script src="libs/js/jquery.mask.min.js"></script>
<div class="inputs-without-icon">
<?php
/* DATE FOUNDATION */
if ($Menu->getFundationDate() == NULL) {
echo "<input type='text' name='dateFoundation' class='input-without-icon metade-without' placeholder='Data de Fundação' id='date-foundation' />";
} else {
$dateF = date_create($Menu->getFundationDate());
echo "<input type='text' name='dateFoundation' class='input-without-icon metade-without' placeholder='Data de Fundação' id='date-foundation' value='" . date_format($dateF, 'dmY') . "' />";
}
/* CNPJ */
if ($Menu->getCnpj() == NULL) {
echo "<input type='text' name='cnpj' class='input-without-icon metade-without' placeholder='CNPJ (números)' id='cnpj'/>";
} else {
echo "<input type='text' name='cnpj' class='input-without-icon metade-without' placeholder='CNPJ (números)' id='cnpj' value='{$Menu->getCnpj()}'/>";
}
?>
</div>