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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:53:13+00:00 2026-06-09T16:53:13+00:00

Is there an attribute or technique for HTML select fields that’s equivalent to readOnly=true

  • 0

Is there an attribute or technique for HTML select fields that’s equivalent to readOnly="true" for HTML inputs?

I have an form select field I’d like to disable, but still pass on when the form is posted. If this were an HTML input, I’d do something like this

$('select_id').setAttribute('readOnly', 'true');

and the browser would render the field as un-editable, but it’s value would still be passed to the backend. I’d like something similar for an HTML select, but doing the following

$('#select_id').setAttribute('readOnly', 'true');

doesn’t work. The attribute is successfully added to the DOM, but the browser still renders it as selectable.

I realize I could do the following

$('#input_id').disabled();

but when a field is disabled its value isn’t passed through to the backend.

I’d like a way to disable this select field but still pass in on to the backend.

(examples use Prototype JS, but I’m interested in any general solution)

  • 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-09T16:53:15+00:00Added an answer on June 9, 2026 at 4:53 pm

    Disable all but the selected option:

    ​

    <select>
    <option disabled="disabled">1</option>
    <option selected="selected">2</option>
    <option disabled="disabled">3</option>
    </select>
    

    This way the dropdown still works (and submits its value) but the user can not select another value.

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

Sidebar

Related Questions

In JPA there is an attribute called referencedColumnName that can be set on @JoinColumn,
I have a resume that I'm trying to translate from MS Word into HTML
Is there a technique to use an accesskey attribute on an <option> tag? I
Is there any attribute associated with the starting time I can get from the
There is no align attribute with font tag because It is an inline element.
Is there a MSBuild task for setting custom attribute in AssemblyInfo.cs? I found AssemblyInfo
Is there a pragma or debugger attribute which will allow the debugger to not
Is there a way to override an attribute setter on activeresource when the object
Is there a possiblity to add the auto_increment attribute to QueryNew() in Coldfusion? I
in a Table there is a single attribute(column).it contains numbers.Some are repeated(2 or 3

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.