且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在MVC3中使用Jquery进行验证

更新时间:2022-02-21 08:35:29

看看这些:
jQuery验证插件 [ ASP.NET MVC3中的自定义客户端验证 [ ^ ]
MSDN:ASP.NET MVC 3自定义验证 [
Have a look at these:
jQuery validation plugin[^]
Custom Client Side Validation in ASP.NET MVC3[^]
MSDN: ASP.NET MVC 3 Custom Validation[^]


用户名文本框必填字段的说明.


say for required field for Username textbox.





函数validate()
{
var txtValue =




function validate()
{
var txtValue =


(``#txtUsername'').val();

如果(txtValue ==''''|| txtValue == null || txtValue ==未定义)
{
警报(``需要用户名.'');
(''#txtUsername'').val();

if (txtValue == '''' || txtValue == null || txtValue == undefined)
{
alert (''Username is required.'');