Jump to content

string validação campo telefone whmcs


Recommended Posts


  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

1. Baixe jquery.mask.min.jsupem na pasta /templates/seu-tema/js do WHMCS:

2. Usaremos o template SIX nesse tutorial. Vá em templates/six/footer.tpl e insira o código abaixo antes de <script src="{$BASE_PATH_JS}/bootstrap.min.js"></script>

<script type="text/javascript">
$("#phonenumber").keydown(function(){
    try {
    	$("#phonenumber").unmask();
    } catch (e) {}
    
    var tamanho = $("#phonenumber").val().length;
	
    if(tamanho < 10){
        $("#phonenumber").mask("(00) 0000-0000");
    } else if(tamanho >= 11){
        $("#phonenumber").mask("(00) 00000-0000");
    }                   
});
</script>

<script src="{$WEB_ROOT}/templates/{$template}/js/jquery.mask.min.js"></script>

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.




×
×
  • Create New...