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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:18:58+00:00 2026-05-27T16:18:58+00:00

I have two span’s which contain a HTML text box with same id say

  • 0

I have two span’s which contain a HTML text box with same id say “field1”. Based on a drop down value, only of these two span’s are shown in the screen at a given time. Either one of the span’s is shown or none of them are shown.

I am using .hide(); and .show(); in prototype js to show and hide these span’s based on the drop down value. But whenever I try to get the value by $F('field1'); on submit, I only get the first HTML text box’s value(which is empty).

Is there a way I can solve this to get the value of visible HTML text box value?

  • 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-27T16:18:59+00:00Added an answer on May 27, 2026 at 4:18 pm

    Use class. ID for an element should be unique as it’s an ID 😉

    1. select all elements with specified class name. you will get an array of elements having specified class name.

      var eleCollection = document.getElementByClassName("anyClassName");
      
    2. After this, u can loop through this array of elements and get their values

      for(element in eleCollection) {
          var thisValue = element.getAttribute("value");
         console.log("Element: ",element," value: ",value);
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an element that contains two span tags that each contain some text.
I have two span elements that I would like to stay on the same
I have two <span> -tags with the same ID in different places om my
I have two span tags that contain content. The first span tag will hold
I have two elements that I am trying to line up, a text box
I have two span elements. I want them to sit side-by-side and contain some
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
I have two slider handles with <span> appended to them. Meaning sliders can be
I have two radiobuttonlist and one checkboxlist on the page. Ideally based on the
I have two divs as follows: <div class=car-service id=browse-all-button> <p>CAR SERVICE</p> <span>56 Race Ramps</span>

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.