Hide a javascript mask

Asked

Viewed 87 times

1

Does anyone know how to hide Mask _ (javascript) for example on my site:

Name: _ _ _ _ _ _ _ _ _ _

and I wanted to hide the "_".

<script src="ajax.googleapis.com/ajax/libs/jquery/1.12.0/…;
<script src="cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/…;
<script src="cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/…;
<script type="text/javascript">
$(document).ready(function(){
   $("#cc").mask("999999999999");
   $("#ciclo").mask("9999-9999");
});
  • Is using some plugin ?

  • How are you doing to show the mask? Which plugin is using?

  • I’m using <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>&#xA; <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.js"></script>&#xA; <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/jquery.maskedinput.min.js"></script>&#xA; <script type="text/javascript">&#xA; $(document).ready(function(){&#xA; $("#cc").mask("999999999999");&#xA; $("#ciclo").mask("9999-9999");&#xA; });

1 answer

3


Can replace the _ for nothing adding the optional argument placeholder. This is indicated in documentation of the plugin

$("#ciclo").mask("9999-9999", {placeholder:" "});
  • Just to let you know: the placeholder defines what will appear when the number is replaced. You can also change the digit '9' to '#', so avoid the bug in case of filling the number 9. $("#ciclo").mask("####-####", {definitions:{'#': "[0-9]"}, placeholder:" "}); In other things: see here

Browser other questions tagged

You are not signed in. Login or sign up in order to post.