Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. attr disabled property is not working for FF

attr disabled property is not working for FF

Scheduled Pinned Locked Moved JavaScript
javascript
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dayakar_dn
    wrote on last edited by
    #1

    Hi, i like to disable the buttons on check of the checkbox....using Jquery i have tried in 3 different ways... 1.attr("disabled", true)-- working in IE not in FF 2.attr("disabled", "disabled")- working in IE not in FF 3.attr("diabled") not working in both... i want to know the property which is supported by all the browsers(like safari, chrome etc..) thanks in advance

    G M E 3 Replies Last reply
    0
    • D dayakar_dn

      Hi, i like to disable the buttons on check of the checkbox....using Jquery i have tried in 3 different ways... 1.attr("disabled", true)-- working in IE not in FF 2.attr("disabled", "disabled")- working in IE not in FF 3.attr("diabled") not working in both... i want to know the property which is supported by all the browsers(like safari, chrome etc..) thanks in advance

      G Offline
      G Offline
      Graham Breach
      wrote on last edited by
      #2

      I suspect the problem is somewhere else. $('#id').attr('disabled',true) is working for me in FireFox, IE, Chrome and Opera. Setting it back to 'false' enables the inputs again.

      1 Reply Last reply
      0
      • D dayakar_dn

        Hi, i like to disable the buttons on check of the checkbox....using Jquery i have tried in 3 different ways... 1.attr("disabled", true)-- working in IE not in FF 2.attr("disabled", "disabled")- working in IE not in FF 3.attr("diabled") not working in both... i want to know the property which is supported by all the browsers(like safari, chrome etc..) thanks in advance

        M Offline
        M Offline
        Mohibur Rashid
        wrote on last edited by
        #3

        I agree with graham I tested with below code:

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

        <input type='checkbox' value='10' id='id'> <label for='id'>Test Checkbox</label>

        <BUTTON onclick='a=!($("#id").attr("disabled")); $("#id").attr("disabled",a)'>
        test
        </BUTTON>

        it work fine

        R 1 Reply Last reply
        0
        • D dayakar_dn

          Hi, i like to disable the buttons on check of the checkbox....using Jquery i have tried in 3 different ways... 1.attr("disabled", true)-- working in IE not in FF 2.attr("disabled", "disabled")- working in IE not in FF 3.attr("diabled") not working in both... i want to know the property which is supported by all the browsers(like safari, chrome etc..) thanks in advance

          E Offline
          E Offline
          Ed Nutting
          wrote on last edited by
          #4

          The code you are using has always worked for me so not sure what's wrong but as a point, the second one in your list is the correct one. If you are trying to enable the check boxes again you will have to use the removeAttr method as W3 standards say that the mere presence of the disabled attribute means the control is disabled, regardless of value (which some of the major browsers follow). As for why your check boxes don't disable I can only suggest that IE and FF are handling your HTML differently (check Id's are the same, that you are only trying to set the disabled attribute after full page load (use $(document).ready if you aren't!) etc. etc.) Hope this helps, Ed

          1 Reply Last reply
          0
          • M Mohibur Rashid

            I agree with graham I tested with below code:

            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

            <input type='checkbox' value='10' id='id'> <label for='id'>Test Checkbox</label>

            <BUTTON onclick='a=!($("#id").attr("disabled")); $("#id").attr("disabled",a)'>
            test
            </BUTTON>

            it work fine

            R Offline
            R Offline
            ramuAlla
            wrote on last edited by
            #5

            If I will use and ....How can I disable checkbox

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups