0

Possible Duplicate:
What's the proper way to add selected and related attributes to inputs?
Correct value for disabled attribute

I have the following:

    <button id="refreshLink" class="blue" type="button" title="Refresh Topic Grid"
        data-entity="Topic"
        data-href="/Admin/Contents/Reference">
        <span class="center-icon sprite-arrow-circle"></span></button>

I saw lots of different ways to make this disabled.

disabled=true
disabled=disabled
disabled

Which is the correct way to do this? I am getting confused.

Community
  • 1
  • 1
  • 1
    which version of Html? I think html5 can have a different syntax. And doesn't your prefered web editor suggest you the correct syntax (I use Visual studio, and it's one of its feature). – Steve B Jul 26 '12 at 13:07
  • 1
    Also [Correct value for disabled attribute](http://stackoverflow.com/q/6961526) – Pekka Jul 26 '12 at 13:07

3 Answers3

2

The second two (disabled=disabled and disabled) are both correct. You can choose which one to use based on personal preference. The disabled attribute is a Boolean attribute, which can not contain the value true (although it will still work).

Inkbug
  • 1,682
  • 1
  • 10
  • 26
0

disabled="disabled" and disabled are the same thing.

Both are well understood by browsers.

I've never seen disabled=true, so consider that it's probably not a good practice.

EDITED.

Fore information, W3C recomendations is :

<button disabled>

Source: http://www.w3.org/TR/html401/interact/forms.html#h-17.12.1

( bad link keep for history: http://www.w3schools.com/tags/att_button_disabled.asp )

Dekx
  • 402
  • 2
  • 15
0
disabled=disabled 

Is the Correct function as per my understanding

if you give disabled=xxx i.e)it also works but disabled=disabled is correct one

Jayamurugan
  • 1,757
  • 2
  • 14
  • 34