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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:41:06+00:00 2026-06-16T14:41:06+00:00

I have another (probably simple) Jquery question. I just want to display the selected

  • 0

I have another (probably simple) Jquery question. I just want to display the selected value of a dropdown list using Jquery. I have saved the selected value to a database and now just need it to be displayed when the user comes back to the page. I have tried every method I can think of (and google’s search results!) but it doesn’t work. I must be missing something simple (again) please help! I have tried the following:

$(document).ready(function() {

$("quantity").val('2');
$("quantity").text('2');
$("quantity .ui-btn-text").text('2');

$("quantity").filter(function() {
   return $(this).text() == '2';
}).attr('selected', true);

}​

and here is a JSfiddle: http://jsfiddle.net/zv58e/

Help!
Thanks
Dan

  • 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-16T14:41:07+00:00Added an answer on June 16, 2026 at 2:41 pm
     $("quantity")
    

    should

     $("#quantity").val(2);
    

    Demo

    Or

    $('select[name="quantity"]').val(2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

another probably simple iPhone obj-c question for you... I have a couple of alerts
I have another late night brain-dead question. It's probably simple to do but you
another fun (and probably really simple) question for you, that I have half worked
i have another (probably unanswered) question about map views. I have a map view
I have another simple question about Node. I'm trying to make a simple http
This is probably a simple question, I have a form that you put in
This is probably a very simple and stupid question to ask, but I have
Probably simple question and I'm just missing something, but I'm stuck out of ideas.
here's my probably (and hopefully) simple problem: i have a list with images as
UP-FRONT NOTE: I am not using jQuery or another library here because I want

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.