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 9112737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:48:24+00:00 2026-06-17T03:48:24+00:00

I have created an editable form that allows users to edit their profile information.

  • 0

I have created an editable form that allows users to edit their profile information.
This form can be saved and revisted so I need to be able to save the updates as the user goes along.
This is working ok.

The form is very long so in some sections I have fields that show / hide using jquery depending on the yes or no selections for a previous input.
This also works except that if a radio input is selected and saved whe the form is revisted the jquery has hidden the details field again.

So what I need is some help amending the following jquery code so that if neither radio button is seleced the details div is hidden but if the Yes option is selected and saved it will automatically open when the form is revisted! Thanks

$("#diet-details").hide();
$("input[name=diet]").click(function() {
    if ( $("#diet1").attr('checked'))
        $("#diet-details").hide();

    if ( $("#diet2").attr('checked'))
        $("#diet-details").show();
});      
  • 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-06-17T03:48:25+00:00Added an answer on June 17, 2026 at 3:48 am

    You can pass the show/hide condition to the toggle function, and instead of always hiding the diet-details div in the beginning, check if diet1 option is checked and show it (or hide it) based on that,

    $(function() {
      $('#diet-details').toggle($("#diet1").is(':checked'));
    
      $("input[name=diet]").click(function() {
        $('#diet-details').toggle($("#diet1").is(':checked'));
      }); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a content editable div where users can enter their bio and then
I'm working on page that allows users to edit profile info. I want them
I have customized jqGrid's edit form to have some fields that use jQuery's DatePicker
I'm trying to build a form that allows users to update some records. They
I have a form that is written in MXML that allows a user to
I have created a form that displays values in plain displayfields. There is an
The idea is that I have a form with two editable fields, data is
I'm creating an app where users can edit their own CSS (in SCSS syntax
I have created some JQuery that will expand a div 'popup' on hover and
I have created an android application that calls (using kSOAP library) a SOAP based

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.