<script src="assets/js/jquery-2.2.3.js"></script>
<script src="assets/js/jquery.validate.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.15.0/jquery.validate.js"></script>
<script type="text/javascript">
    $.validator.addMethod("lettersonly", function (value, element) {
        return this.optional(element) || /^[a-z]+$/i.test(value);
    }, "Letters only please");
    $(document).ready(function () {

            $("").validate({

                rules: {
                    fname: {

                        required: true,
                        lettersonly: true
                    }
                },
                messages: {

                }
            });

    });
</script>

this is the script i want to validate fname textbox what shoud i write in $('').validate().

tried to do it with classes also Here are some div's i am confuse what how to make textbox validate

    <div class="page-register rlp">       
    <div class="container">    
        <div class="register-wrapper rlp-wrapper reg-sk">            
            <div class="register-table rlp-table">                   
                <a href="index.html">
                    <img src="assets/images/logo-color-1.png" alt="" class="login" /></a>


                <div class="register-title rlp-title">create your account and join with us!</div>

              <div id="div">


                  <div class="register-form bg-w-form rlp-form">   


                            <div class="col-md-6" id="values">

                                <label for="regname" class="control-label form-label">
                                    NAME <span class="highlight">*<br />
                                    </span>
                                </label>
                                <!--p.help-block Warning !-->
                                <br />
                                <asp:TextBox ID="fname" CssClass="form-control form-input" runat="server"></asp:TextBox>
                            </div>                   
                                       </div>   

                    <div class="register-submit">
                        <button type="submit" onclick="window.location.href='index.html'" class="btn btn-register btn-green">
                            <span>
                                <asp:Button ID="Button1" runat="server" Text="Submit" Style="background-color: transparent" BorderStyle="None" /></span></button>
                 </div>              
                    </div>   
                </div> 
            </div>        
        </div>

    </div>

i have created this page from masterpage

Related posts

Recent Viewed