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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:37:50+00:00 2026-06-07T19:37:50+00:00

I am grabbing all inputs from a 5 tab form. When cyclying through them

  • 0

I am grabbing all inputs from a 5 tab form. When cyclying through them I am adding them to a review section. I have it working fine but I want to show the text of the select drop downs rather then the value as the value would not make sense to the user. Here is a couple of snippets of code I am using. This is inside and $(:input.each(function(){} I check to see if it is a select. If so I set a tmp variable and add on ‘_in’ to the name as I have all field names plus that on the confirm tab. Then I check the length of the new variable to make sure it is on the confirmation tab. If so update the html to the text. The issue is it shows all drop down text options. If I do .val() it gives only the value of the selected one.

//Gives all text options from the drop down.
if ($(this).prop('type') == 'select-one') {
  var tmp = '#'+$(this).attr('name')+'_in';
  if ($(tmp).length > 0) {
    $(tmp).html($(this).text());
  }         
}

//Gives only value of selected option from drop down.
if ($(this).prop('type') == 'select-one') {
  var tmp = '#'+$(this).attr('name')+'_in';
  if ($(tmp).length > 0) {
    $(tmp).html($(this).val());
  }

Fixed solution

if ($(this).prop('type') == 'select-one') {
  var tmp = '#'+$(this).attr('name')+'_in';
  var tmp2 = '#'+$(this).attr('name')+' option:selected';
  if ($(tmp).length > 0) {

tmp3 = $(tmp2).text();
$(tmp).html(tmp3);
}           
}
  • 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-07T19:37:52+00:00Added an answer on June 7, 2026 at 7:37 pm

    You can get the text of a select by using

    $("#yourdropdownid option:selected").text();

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

Sidebar

Related Questions

I have this XML file from which I'm grabbing all the data: <?xml version=1.0
What's the best method for looping through a table, grabbing all the data in
Grabbing delimited dates from database and adding new ones to the list, then want
I'm grabbing all the filenames from a directory and I want to create a
When I am grabbing data from my table that require permissions, should all the
I'm working on an application that needs to accept posted data from a form
My goal is to filter through a Microsoft Word Document (.docx) grabbing all Japanese
I'm grabbing data from a published google spreadsheet, and all I want is the
I am using ajax and php and I grabbing all of the points out
I'm grabbing a list of events from a database and am trying to associate

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.