當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


jQWidgets jqxValidator arrow屬性用法及代碼示例


jQWidgets 是一個 JavaScript 框架,用於為 PC 和移動設備製作基於 Web 的應用程序。它是一個非常強大、優化、獨立於平台且得到廣泛支持的框架。 jqxValidator 用於在 JavaScript 的幫助下驗證 HTML 表單。它根據用戶輸入驗證的要求,有一組內置規則,e-mail、SSN、ZIP、最大值、最小值、間隔等。自定義規則也可以根據具體情況編寫要求。

屬性用於設置或獲取指定提示的箭頭是否jqx驗證器將顯示或不顯示。此方法接受兩個值:真的' 和 '錯誤的'。

用法:

  • 用於設置屬性。

    $('#jqxValidator').jqxValidator( { arrow: false } );  
  • 為了得到屬性。

    var arrow = $('#jqxValidator').jqxValidator('arrow'); 

鏈接文件:下載jQWidgets從給定的鏈接。在 HTML 文件中,找到下載文件夾中的腳本文件。

<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxvalidator.js”></script>

例子:下麵的例子說明了 jQWidgets屬性。在下麵的示例中,值屬性已設置為真的。

HTML


<!DOCTYPE html> 
<html lang="en"> 
  
<head> 
    <link rel="stylesheet" 
          href="jqwidgets/styles/jqx.base.css" 
          type="text/css"/> 
    <script type="text/javascript" 
            src="scripts/jquery.js"> 
    </script> 
    <script type="text/javascript" 
            src="jqwidgets/jqxcore.js"> 
    </script> 
    <script type="text/javascript" 
            src="jqwidgets/jqx-all.js"> 
    </script> 
    <script type="text/javascript" 
            src="jqwidgets/jqxvalidator.js"> 
    </script> 
</head> 
  
<body> 
    <center> 
        <h1 style="color:green;"> 
            GeeksforGeeks 
        </h1> 
        <h3> 
            jQWidgets jqxValidator arrow Property 
        </h3> 
        <form id="Employee_Form"> 
            <table> 
                <tr> 
                    <td>Employee_Name:</td> 
                    <td> 
                        <input type="text" id="Employee_Name"/> 
                    </td> 
                </tr> 
                <tr> 
                    <td>Employee_Id:</td> 
                    <td> 
                        <input type="text" id="Employee_Id"/> 
                    </td> 
                </tr> 
                <tr> 
                    <td>Designation:</td> 
                    <td> 
                        <input type="text" id="Designation"/> 
                    </td> 
                </tr> 
                <tr> 
                    <td>Base_Location:</td> 
                    <td> 
                        <input type="text" id="Base_Location"/> 
                    </td> 
                </tr> 
            </table> 
        </form> 
        <input type="button" style="margin:28px;" 
               id="button_for_arrow" 
               value="Value of the arrow property"/> 
        <div id="log"></div> 
  
        <script type="text/javascript"> 
            $(document).ready(function () { 
                $('#Employee_Form').jqxValidator({ 
                    arrow: true, 
                    Rules: [ 
                        { 
                            input: '#Employee_Name', 
                            message: 'Employee name is mandatory!', 
                            rule: 'required' 
                        }, 
                        { 
                            input: '#Employee_Id', 
                            message: 'Employee_Id is mandatory!', 
                            rule: 'required' 
                        }, 
                        { 
                            input: '#Designation', 
                            message: 'Designation is mandatory!', 
                            rule: 'required' 
                        }, 
                        { 
                            input: '#Base_Location', 
                            message: 'base location is mandatory!', 
                            rule: 'required' 
                        }], 
                }); 
                $("#button_for_arrow").jqxButton({ 
                    width: 250 
                }); 
                $("#button_for_arrow").click( 
                    function () { 
                        var Value_of_arrow = 
                            $('#Employee_Form').jqxValidator('arrow'); 
  
                            $("#log").html( 
                               JSON.stringify(Value_of_arrow)); 
                    }); 
               }); 
        </script> 
    </center> 
</body> 
</html>

輸出:

參考: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxvalidator/jquery-validator-api.htm?search=



相關用法


注:本文由純淨天空篩選整理自Kanchan_Ray大神的英文原創作品 jQWidgets jqxValidator arrow Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。