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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:55:33+00:00 2026-06-09T16:55:33+00:00

I have a form where, if the user selects married from a drop down

  • 0

I have a form where, if the user selects “married” from a drop down list, some text fields will be displayed asking for their spouse’s information. Everything works fine in Firefox and IE, but Safari is giving me trouble.

Here is the HTML:

<ul>
<li>
              <label for="maritalStatus">Marital Status</label><br/>
              <select name="maritalStatus" id="maritalStatus" tabindex="80">
                <option name="Single" id="Single" value="Single" selected="selected" onClick="imSingle()">Single</option>

                <option id="Married" name="Married" value="Married" onClick="imMarried()">Married</option>

              </select>
            </li>

<li id="spouseFullName">
              <label for="spouseFullName">Spouse Full Name</label><br/>
              <input type="text" name="Spouse Full Name" id="spouseFullNameField" onchange="spouseName()" tabindex="90"/>
            </li>
            <li id="spouseDOB">
              <label for="spouseDOB">Spouse Date of Birth</label><br/>
              <input type="text" name="Spouse DOB" id="spouseDOB" tabindex="100" />
            </li>
            <li id="spouseOccupation">
              <label for="spouseOccupation">Spouse Occupation</label><br/>
              <input type="text" name="Spouse Occupation" id="spouseOccupation" tabindex="101" />
            </li>
</ul>

Here is the javascript:

document.getElementById("spouseFullName").style.display = "none";
document.getElementById("spouseDOB").style.display = "none";
document.getElementById("spouseOccupation").style.display = "none";

function imMarried() {
    if (document.getElementById('Married').selected){
        document.getElementById("spouseFullName").style.display = "block";
        document.getElementById("spouseDOB").style.display = "block";
        document.getElementById("spouseOccupation").style.display = "block";
    }
}

I do have javascript enabled.

  • 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-09T16:55:34+00:00Added an answer on June 9, 2026 at 4:55 pm

    has to be

    function imMarried() {
        var maritalStat = document.getElementById('maritalStatus');
        if (maritalStat.options[maritalStat.selectedIndex] && maritalStat.options[maritalStat.selectedIndex].value=="Married") {
            document.getElementById("spouseFullName").style.display = "block";
            document.getElementById("spouseDOB").style.display = "block";
            document.getElementById("spouseOccupation").style.display = "block";
        }
    }
    

    and also add onchange trigger to select and remove onclick from option, i.e.:

    <select name="maritalStatus" id="maritalStatus" tabindex="80" onchange="imMarried()">
    ...
    <option id="Married" name="Married" value="Married">Married</option>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a form that has a multiple select drop down. a user can
I have a form where user selects 'fruit's from a popup form. I am
I have a form drop down box (for the 50 states) that is populated
I have a form which contain some radio button and check-boxes . Whenever user
I have a simple form for a hotel accommodation tool. User selects the number
I have form, where user selects Airport and then can select one of airport
I have a form with a list box and a few text boxes, when
I have a form contains text fields,a textView and 2 switches.Now I am using
I have a rails form where user has to select a value from a
I have a form in which the user can choose a component type from

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.