【问题标题】:jQuery Interaction Cues for Error State Style错误状态样式的 jQuery 交互提示
【发布时间】:2012-02-14 07:12:54
【问题描述】:

我正在尝试使用 jQuery CSS 框架来设置必填字段错误的样式。当表单提交时文本框中没有值,应该阻止表单提交,并显示如下对应的样式。

• ui-helper-reset

• ui-helper-clearfix

• 用户界面状态错误文本

• ui-icon-alert

最好的方法是什么?

注意:代码对应ASP.NET (form runat="server")

代码:

<html lang="en">

<head>

<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.6/jquery-ui.js"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.13/themes/flick/jquery-ui.css"
    rel="stylesheet" type="text/css" />
<title>Interaction cues</title>
</head>

<body>
    <%-- ui-helper-reset, ui-helper-clearfix, ui-state-error-text,  ui-icon-alert--%>
    <form runat="server" >

        <div> 
            <a> User Name </a>
            <input id="Text1" type="text" />
            <span> * </span>
            <a>Required field</a> 
        </div>

    <input id="Button1" type="button" value="button" />
    </form>
</body>

</html>

【问题讨论】:

  • 任何人都可以提供与此相关的任何链接吗?

标签: jquery asp.net .net jquery-ui


【解决方案1】:
  • 在按钮上添加onclick事件,
  • 在onclick函数上放所有你想要的验证
  • 如果成功 __doPostBack('','');
  • 如果显示消息失败或什么的

【讨论】:

    猜你喜欢
    • 2018-04-15
    • 2021-01-19
    • 1970-01-01
    • 2011-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-14
    相关资源
    最近更新 更多