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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:00:36+00:00 2026-05-28T18:00:36+00:00

Using jquery how do i simply check if it is read only? this is

  • 0

Using jquery how do i simply check if it is read only?

this is what i am trying..

$("#item").keydown(function (event) {
     //alert(event.keyCode);
     if (event.keyCode == 13) {
         $("#ok").click();               
         if ($('#dropLength').prop("disabled") == false) {
             $("#dropLength").focus();
             return;
         }
         if ($('#dropUnit').prop("disabled") == false) {
             $("#dropUnit").focus();
             return;
         }
         $("#qty").focus();                
         return ;
     }
 });

The dropdowns are set to readonly using jquery also:

if ($('#dropLength').find('option').length <= 1) {
      $('#dropLength').attr("disabled", "disabled");
}
if ($('#dropUnit').find('option').length <= 1) {
      $('#dropUnit').attr("disabled", "disabled");
}   
  • 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-28T18:00:37+00:00Added an answer on May 28, 2026 at 6:00 pm

    The legacy solution, before 1.6, was to use .attr and handle the returned value as a bool. The main problem is that the returned type of .attr has changed to string, and therefore the comparison with == true is broken (see http://jsfiddle.net/2vene/1/ (and switch the jquery-version)).

    With 1.6 .prop was introduced, which returns a bool.

    Nevertheless, I suggest to use .is(), as the returned type is intrinsically bool, like:

    $('#dropUnit').is(':disabled');
    $('#dropUnit').is(':enabled');
    

    Furthermore .is() is much more natural (in terms of “natural language”) and adds more conditions than a simple attribute-comparison (eg: .is(':last'), .is(':visible'), … please see documentation on selectors).

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

Sidebar

Related Questions

I am simply looking for a way of using drag and drop without jquery
I'm using the simple jQuery DIV refresh code. var refreshId = setInterval(function() { $('#refreshdash').load('dashboard.php?cache=');
I'm trying to create a simple toggling sidebar using jquery, where it expands and
Hey all, I'm using this colorpicker ( http://www.eyecon.ro/colorpicker ) and am trying to capture
In a JS function using setIntervall, I want to perform a jquery animation every
I'm using jquery uniform on one of the project I'm working on. Since this
I have read jQuery Event Keypress: Which key was pressed? and How can i
I've just started using jQuery, and can't get my head around this. I need
I am using jQuery for a simple website and have a main page 'index.html'
Using JQuery, is there a simple way to select the text immediately after a

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.