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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:07:30+00:00 2026-06-18T07:07:30+00:00

I am trying to set the selected attribute on a select pull down with

  • 0

I am trying to set the selected attribute on a select pull down with jquery val(). I only have the caption (aka innerhtml) of the element I want the selected, but not the value.
For example:

A pulldown of states. I want the “New york” option to be selected. I want to write a jquery statement which does

$("#pull-down").val([get value of the option tag which has "New York" as its innerhtml])

Is this possible?

  • 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-18T07:07:31+00:00Added an answer on June 18, 2026 at 7:07 am

    You can use filter method.

    $("#pull-down").val(function(){
        return $('#selectElement option').filter(function(){
                    return $(this).text() === 'New York';
               }).val();
    });
    

    In case that #pull-down is a select element and the option element that contains New York is child element of it, you can use prop method.

    $('#pull-down option').filter(function(){
         return $(this).text() === 'New York';
    }).prop('selected', true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to set the selected value in a dropdownlist using jquery, I
I'm trying to set the selected Value for a drop down list. In Controller
I am trying to set the selected values for a MultiSelectList but the page
I am trying to set the selected value of a combobox from a style
i'm trying to set a cookie to store a selected department in. The cookie
I'm trying to make a style for a listbox which will set the selected
I am trying to change the selected option in a select dropdown box with
Trying to change the selected text background color for an NSTextField (we have a
I'm trying to set the selected date so that it is always the current
i am having trouble. i write HTML and jQuery and set same name attribute

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.