Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6568771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:31:15+00:00 2026-05-25T14:31:15+00:00

$(document).ready(function(){ $("#esp").click(function(){ $(".auth_type").slideDown("normal"); $("#no").click(function(){ $(".auth_other").slideUp("normal"); }); $("#yes").click(function(){ $(".auth_other").slideDown("normal"); }); }); $("#ah").click(function(){ $(".auth_type").slideUp("normal"); }); });

  • 0
$(document).ready(function(){
    $("#esp").click(function(){ 
        $(".auth_type").slideDown("normal");
        $("#no").click(function(){
             $(".auth_other").slideUp("normal");                     
        });
        $("#yes").click(function(){
             $(".auth_other").slideDown("normal");           
        });
   });
            
   $("#ah").click(function(){ 
        $(".auth_type").slideUp("normal");

   });
});

there are two radio buttons on my web page with id (#ah) and id (#esp)

1. when user click on esp radio button then a table row with class(auth_type) should appear.It also have two radio buttons in it with id no and id yes

if user clicks yes then further a table row with class (auth_other) should appear and if no selected then it should disappear

2. when user clicks on ah radio button the then table row with class (auth_type) should disappear.

Everything is working fine also now problem is that when when user have selected no and clicked on ah radio button also then table row with class auth_other is appeared which should not be .

I tried to handle it and added following lines to the jquery code for esp radio button

var sel = $(":radio[name='auth_opt']:checked").val();   

if(sel=='n')
     $(".auth_type").slideDown("normal");

but din’t worked …

I thought that when user clicked no as wll as ah then i should make it forcefully appeared .

Is there any mechanism by which i can force the radio buttons with class "auth_type" to be checked by default on "yes" button whenever user clicked on "ah" or from "ah" to back on "esp".I think that may solve the problem.

I am new to jquery but have worked with javascript so if someone could tell me Is there something wrong with the above jquery code??

The Whole HTML code is very long so just showing the HTML for the class "auth_type" .
If needed i will add the code for class "auth_other" also.

..
....
<tr class="auth_type" style="display:none">
<td width="400" height="40">Apply Authentication</td>
<td>
  <table width="100%">
  <tr>
  <td style="text-align:center">
  <input type="radio" name="auth_opt" value="y" id="yes" align="left" checked="checked" />yes
  </td>

  <td style="text-align:center">
  <input type="radio" name="auth_opt" value="n" id="no" align="right"/>no
  </td>

  </tr>
  </table>


  </td>
  </tr>
...
...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:31:16+00:00Added an answer on May 25, 2026 at 2:31 pm

    You don’t really need to concern yourself with the #yes and #no button specifically. You just need to say “when one of the radio buttons inside .auth_type is clicked, hide or show the .auth_other row depending on which of the two buttons it was”. This is what this code does:

    $(".auth_type input:radio").click(function() {
        if ($(this).val() == "y") {
            $(".auth_other").slideDown("normal");                     
        }
        else {
            $(".auth_other").slideUp("normal");                     
        }
    });
    

    Also, you should not put the code that attaches the click event handlers inside the #esp click handler itself:

    $("#esp").click(function(){ 
        $(".auth_type").slideDown("normal");
    
        // NOT IN HERE!
    });
    
    // OUT HERE IS CORRECT
    $(".auth_type input:radio").click(function() {
        if ($(this).val() == "y") {
            $(".auth_other").slideDown("normal");                     
        }
        else {
            $(".auth_other").slideUp("normal");                     
        }
    });
    

    From what you describe, you might also want to hide the .auth_other when the #ah radio is selected (it might be showing from an earlier user interaction):

    $("#ah").click(function(){ 
         $(".auth_type").add(".auth_other").slideUp("normal");
    });
    

    See it in action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What am I doing wrong with this Mootools toggle? <script type="text/javascript"> $(document).ready(function(){ $("#trigger").click(function ()
I have some JavaScript code: <script type="text/javascript"> $(document).ready(function(){ $('#calcular').click(function() { var altura2 = ((($('#ddl_altura').attr("value"))/100)^2);
Jquery has a great language construct that looks like this: $(document).ready(function() { $(a).click(function() {
I have the following code: <script type=text/javascript> $(document).ready(function() { $(#Save).click(function() { $.post(url, { data:
I'm using tablesorter and tablesorter.pager. Here is my code: $(document).ready(function() { $("#peopletable") .tablesorter({ widthFixed:
Normal style <a href="#" id="myLink" onclick="myFunc();">click me</a> function myFunc() { alert('hello!'); } jQuery style
I'm currently using the following code for my read more buttons: $(document).ready(function() { $("a.more-link").attr("href",
I have this datatable setup: $(document).ready(function() { $('#RectifiedCount').dataTable( { "bJQueryUI": true, "bProcessing": true, "aLengthMenu":
$(document).ready(function() { $(span.link).mouseover(function(e){ $(this.children).css(display,inline); }); }); I'm not a javascript expert, but I've cobbled
$(document).ready(function(){ $(.txtDate).datepicker({ showOn: both, buttonImage: library/ui/datepicker/img/calendar2.gif, dateFormat: yy/mm/dd, buttonImageOnly: true }); //added this checkbox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.