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

  • Home
  • SEARCH
  • 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 332601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:52:55+00:00 2026-05-12T09:52:55+00:00

How do I set the index of a dropdown in jQuery if the way

  • 0

How do I set the index of a dropdown in jQuery if the way I’m finding the control is as follows:

$("*[id$='" + originalId + "']") 

I do it this way because I’m creating controls dynamically and since the ids are changed when using Web Forms, I found this as a work around to find me some controls. But once I have the jQuery object, I do not know how to set the selected index to 0 (zero).

  • 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-12T09:52:55+00:00Added an answer on May 12, 2026 at 9:52 am

    First of all – that selector is pretty slow. It will scan every DOM element looking for the ids. It will be less of a performance hit if you can assign a class to the element.

    $(".myselect")
    

    To answer your question though, there are a few ways to change the select elements value in jQuery

    // sets selected index of a select box to the option with the value "0"
    $("select#elem").val('0'); 
    
    // sets selected index of a select box to the option with the value ""
    $("select#elem").val(''); 
    
    // sets selected index to first item using the DOM
    $("select#elem")[0].selectedIndex = 0;
    
    // sets selected index to first item using jQuery (can work on multiple elements)
    $("select#elem").prop('selectedIndex', 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to set the selected index of a RadioGroup in android,
Does anyone know of a simple way to set a selected index or item
I have a dropdown menu and although i have set z-index to 999 on
i am trying to set the index of an dropdown to 0; if the
Is it possible to set z-index that only applies to a certain 'scope', such
The first index is set to null (empty), but it doesn't print the right
Can you set the Z-Index for an image in HTML without writing or embedding
How do I set a 2D index in play morphia? Example: db.places.ensureIndex( { loc
So I've been using : treeView.setCurrentIndex( index ) to set the active item in
I'm having an issue where if I set the z-index of a parent element

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.