I want to change the required message for the elements but I don't know why my script doesn't work! Are the src's correct?!
<head>
<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="/Scripts/jquery-1.10.2.min.js"></script>
<script>
$('#form1 input[type=text]').on('change invalid', function () {
var textfield = $(this).get(0);
// 'setCustomValidity not only sets the message, but also marks
// the field as invalid. In order to see whether the field really is
// invalid, we have to remove the message first
textfield.setCustomValidity('');
if (!textfield.validity.valid) {
textfield.setCustomValidity('Some message... ');
}
});
</script>
And here is the body.
<form id="form1" class="form-basic" action="~/MortgageAndRent/InsertMortgageAndRent/" method="post" >
<input type="hidden" name="UserId" value="@Model.UserId" />
<div class="form-row">
<label>
<span>Province</span>
<input type="text" name="AddressViewModel.Province" value="@Model.AddressViewModel.Province" required />
</label>
</div>
<div class="form-row">
<label>
<span>City</span>
<input type="text" name="AddressViewModel.City" value="@Model.AddressViewModel.City" required />
</label>
</div>
. . .