How to import external JavaScript and put masks in inputs?

0

Hello, how are you?

I saw some tutorials on the internet to put masks in input in HTML, and since I am new to JavaScript I imported the external library as shown below, but I must have imported wrong or used the function incorrectly because the mask is not being applied .

Follow the code:

<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.maskedinput.js" type="text/javascript"></script>
<script type="text/javascript">
    [...]

    jQuery(function($){
        $("#inputTelefone").mask("(99) 9999-9999");
    });
</script>

[...]

<input type="text" name="contato" id="inputTelefone" class="form-control">

Note: I'm using the Masked Input Plugin for jQuery plugin, which is available at link

I downloaded the file jquery.maskedinput.js from the plugin page, put it in the same folder as the HTML file and it worked.

    
asked by anonymous 06.10.2017 / 19:16

1 answer

-3
 <script>
   $(document).ready(function () {
       $("#inputTelefone").mask("(99) 9999-9999");
    });
 </script>

Try to use this way

    
06.10.2017 / 19:19