2
I received "Uncaught Typeerror" while using jQuery’s "Mask" function Mask Plugin.
Here are my includes in the archive editar_usuario.php
.
<script type="text/javascript" src="<?php echo $site."js/chama_ajax.js" ?>"></script>
<script type="text/javascript" src="<?php echo $site."js/jquery/jquery-3.2.1.min.js" ?>"></script>
<script type="text/javascript" src="<?php echo $site."js/jquery_mask_plugin/jquery.mask.min.js" ?>"></script>
<script type="text/javascript" src="<?php echo $site."js/validacoes.js" ?>"></script>
<script type="text/javascript" src="<?php echo $site."js/mascaras_edit.js" ?>"></script>
<script type="text/javascript" src="<?php echo $site."js/js.js" ?>"></script>
My masks code is on file mascaras_edit.js
:
$(document).ready(function($) {
$('#cep_edit').mask('00000-000');
$('#telefone_edit').mask('(00) 0000-0000');
$('#celular_edit').mask('(00) 00000-0000');
$('#cnpj_edit').mask('00.000.000/0000-00', {reverse: true});
$('#cpf_edit').mask('000.000.000-00', {reverse: true});
});
Here is the code (php/html) of the form where the Mask function is being used.
<div class="col-lg-6 form-group" id="cpf_div">
<label>CPF</label>
<input class="form-control" type="text" name="cpf_edit" id="cpf_edit" size="40" value="<?php echo $r['cpf'];?>">
</div>
<div class="col-lg-6 form-group">
<label>Telefone Fixo</label>
<input class="form-control" type="text" name="telefone_edit" id="telefone_edit" size="40" value="<?php echo $r['telefone'];?>">
</div>
<div class="col-lg-6 form-group">
<label>Telefone Celular</label>
<input class="form-control" type="text" name="celular_edit" id="celular_edit" size="40" value="<?php echo $r['celular'];?>">
</div>
<div class="col-lg-6 form-group" id="cep_div">
<label>CEP</label>
<input class="form-control" name="cep_edit" id="cep_edit" type="text" maxlength="9" size="40">
</div>
I tried to follow tips from other questions asked but nothing worked. I’m managing to use the plugin in other parts of the code less in the editing form, also tried to use the plugin’s "Masked" function and it didn’t work (in that file).
Apparently it was conflict with the other mask file.
– João Henrique Egewarth