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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:02:08+00:00 2026-05-29T22:02:08+00:00

I am trying to retain a selected value in the dropdown after posting the

  • 0

I am trying to retain a selected value in the dropdown after posting the page.

Description of scenario

These are my dropdown options

<select id="JqueryDDownForAvailableFrom">
<option value="17:00">17:00</option>
<option value="18:00">18:00</option>
</select>

Before submitting the Page, I am assigning the value to a variable using the below line.

var selectedVal=$("#JqueryDDownForAvailableFrom")

After submitting the page the same dropdown should retail its value.

I do not want to change in options, but want to display the selected value after posting the form.

I have used this one:

This is adding anew option to the dropdown.

$('#JqueryDDownForAvailableTo').append('<option selected="true" value='+selectedValTo+'>' +selectedValTo + '</option>')

I have used this one

This is not selecting the selected value:

  $('#JqueryDDownForAvailableTo').val(selectedValTo);

I tried to find on google but failed.

Any assistance please.

  • 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-29T22:02:09+00:00Added an answer on May 29, 2026 at 10:02 pm

    for getting selected value

    var selectedVal = $("#JqueryDDownForAvailableFrom").val();
    

    for setting selected value

    $("#JqueryDDownForAvailableFrom").val(selectedVal);
    

    hope this helps you

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

Sidebar

Related Questions

I need to retain the dropdown list value after post submit where the values
I'm trying to get the rememberMe() function to remember users and retain sessions for
Trying to make a make generic select control that I can dynamically add elements
I'm trying to backup a folder (e.g) /web/sites to /backups/websites and retain attributes, etc.
I am trying to increment a number by a given value each second and
I am trying to create this dropdown box that slides down and has the
I'm trying to use class names to change the color of a link after
I'm trying to create an UnderConstruction page for my new site. I would like
I'm trying to build an edit page for a database record that can be
I'm trying to retain visible property of a control using view state in the

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.