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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:29:57+00:00 2026-05-28T01:29:57+00:00

I have a form with different options provided by radio buttons. I also have

  • 0

I have a form with different options provided by radio buttons. I also have a script which displays different divs with different form inputs.

This script works fine, my problem is that I have a “previous” link where a user can go one step back and edit already entered data and that I can’t force the different options with the checked attribute to the radio button. It has to be clicked, which make sense because my script uses the .click event.

But how can I say something like: “If $_SESSION[‘unemployed’] == ‘yes’ then echo ‘checked’” and it shows the right option.

I hope I explained myself correctly otherwise fell free to ask.
Please see the code live here http://jsfiddle.net/GEFMX/1/ and my question is if one or more or the checkboxes default is “checked”.

The Javascript I’m using looks like this:

<script type="text/javascript">
$(function() {
    $("input[name$='step2_student']").click(function() {
        var diffoptions = $(this).val();

        $("div.studerende_janej").hide();
        $("#studerende" + diffoptions).show();
    });

    $("input[name$='step2_otheredu']").click(function() {
        var diffoptions = $(this).val();

        $("div.othereducation_janej").hide();
    $("#othereducation" + diffoptions).show();
    });

    $("input[name$='step2_haveeducation']").click(function() {
        var diffoptions = $(this).val();

        $("div.haveeducation_janej").hide();
        $("#haveeducation" + diffoptions).show();
    });
});
</script>

Sincere
– Mestika

  • 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-28T01:29:58+00:00Added an answer on May 28, 2026 at 1:29 am

    You can add some code to your page load to trigger a ‘click’ for all radios that are checked. i.e. something like:

    $(function() {
    
    // .. bind your click events here
    
    $('input[type="radio"]').each(function() {
        if($(this).prop('checked')) $(this).click(); // trigger 'click' if checked
    });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form, which has a few different submit buttons on it all
I have a link which return form with different ID's, and i need to
So I have the following JavaScript: <script language=JavaScript> function reload(form){ var val=form.profile.options[form.profile.options.selectedIndex].value; self.location='?profile=' +
I have a select element in the form with different options. On property of
I have a search form that offers a number of different search options, such
I have a Form being launched from another form on a different thread. Most
I have application in VB.net that have two different form (Form1 and Form2). Now
I have a form that needs to go to different owners depending on the
I would like to have a form that can submit to two different action
I have 3 forms at the same page and each has a different form

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.