I work in MVC5 with an ASP.NET project, so I want to implement MaskMoney jQuery from here Mask Money
First I load the jquery file and add it to my package
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery.maskMoney.js"
));
So, I call it a layout.
@Scripts.Render("~/bundles/jquery")
Finally, in my opinion, I call this using the @ script section at the end of my file:
<script>
$(function () {
$('#Total').maskMoney();
})
</script>
And in my edit, I use id to identify it
@Html.EditorFor(model => model.Total, new { htmlAttributes = new { @class = "form-control", @type = "number",@id="Total", @min = "0", @Value="", @required = "required" } })
but when I load the page, nothing happens, what am I doing wrong?
source
share