$(document).ready(function() {
$("#btnSubmit").click(function() {
var textvalue = $("#txtNumeric").val();
validateDecimal(textvalue);
return true;
});
});
function validateDecimal(value) {
var RE = new RegExp(/^\d*\.\d\d$/);
if (RE.test(value)) {
return true;
} else {
alert("formate numeric with 2 decimal places!");
return false;
}
}
數字字段我使用這個腳本來驗證與2位小數我textnumeric字段值。 其驗證時工作正常。但如果textnumeric字段值是正確的,我沒有從該文本字段獲取任何值到頁面後面的ASP.NET代碼(default.aspx.cs)。 任何人都可以幫我解決這個問題嗎?
爲什麼不使用asp.net驗證器控件? –
我被要求只能通過jquery來完成。 – user1817779