Hello

In Form when I Select "Yes" in Radio button then Textbox Show with validation.(Submit button)
When Click on "No" then submit form without validation.

Here my code

    <form>
        <input type="radio" name="gender" value="yes" >yes
        <input type="radio" name="gender" value="no" checked="checked">No<br/><br/>
            <div id="disp_not">
                Company<input type="text" name="company" value="" id="company" /><br/><br/>
            </div>
        <input type="submit" value="Submit" id="submit"/>
    </form>

    *******************************************************************
    <script type="text/javascript">
    $(document).ready(function(){

        $("#disp_not").hide();
        $("input:radio").change(function(){
        var $value = $("form input[type='radio']:checked").val();

        if($value === 'no')
        {
            $(document).ready(function(){
            $("#disp_not").hide();
            });
        }
        else
        {
            $(document).ready(function(){
            $("#disp_not").show();
            });

            $("#submit").click(function(){
            var $company = $("#company").val();

                 if($company == '')
                {
                alert("Enter company name");
                }
            });

        }
    });
    });
    </script>

Suggest me for solution..

Thank You

You're only creating the submit.click function if 'yes' is clicked. if $value == no then the function never exists.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.