Jquery: Mask does not erase

Asked

Viewed 283 times

0

I’m not able to type anything inside a textbox field that I put date mask, it doesn’t let me erase or type over, it always stays 11/11/1111

It follows below the codes that I put:

All I care about:

    <script src="~/Scripts/jquery-1.10.2.js" type="text/javascript"></script>
<script src="~/Scripts/JavascriptInsano.js" type="text/javascript"></script>
<script src="~/Scripts/jquery.maskedinput.js" type="text/javascript"></script>
<script src="~/Scripts/funcao_validate_data.js" type="text/javascript"></script>

On the same page is the Input:

<div class="form-group">
    @Html.LabelFor(m => m.DataInicio, "Data de Início", new { @class = "col-md-2 control-label" })
    <div class="col-md-10">
        @Html.TextBoxFor(m => m.DataInicio, new { @class = "form-control" })
    </div>
</div>

Now follow the javascript you do with the function:

jQuery(function($){
    $("#DataInicio").mask("11/11/1111",{placeholder:" "});
});

jQuery(function ($) {
    $("#DataTermino").mask("11/11/1111");
}); 
  • On the site of the plugin you will better understand how it works, but I think Fernando Medeiros has already solved his problem below. http://digitalbush.com/projects/masked-input-plugin/

1 answer

1


The mask string must be in the following format, in case it is a number it must be used the number 9 as representation, its error is in using the number 1.

$("#DataTermino").mask('99/99/9999');

Browser other questions tagged

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