Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

disabled="false" doesn't enable...  RSS feed

 
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why disabled="false" doesn't enable radio button? (given that 'disabled' is one of the property of radio button and can have two values 'true' and 'false').

(disabled(false) and disabled:false enable)


Thanks.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
disabled = false eable radio button. :roll:
 
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by rathi ji:
Why disabled="false" doesn't enable radio button? (given that 'disabled' is one of the property of radio button and can have two values 'true' and 'false').

(disabled(false) and disabled:false enable)


Thanks.



I try with the following:
document.searchform.radio1[0].disabled = false;

Its working fine for me.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by KJ Reddy:


I try with the following:
document.searchform.radio1[0].disabled = false;

Its working fine for me.



Yes, the above will work. But if we double quote the false (I mean, "false") then it doesn't work.

:roll:
[ June 26, 2006: Message edited by: rathi ji ]
 
Author and ninkuma
Marshal
Posts: 66491
160
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by rathi ji:

But if we double quote the false (I mean, "false") then it doesn't work.



Then don't double-quote it.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HTML boolean attributes such as disabled and readonly can only legally take the name of the attribute.
eg. disabled="disabled" readonly="readonly"
Most browsers however accept any value for the attribute as being in the affimative.
So the following are equivalent:
disabled="disabled"
disabled
disabled="true"
disabled="false"
disabled="unknown"
disabled="23"
disabled="no"

If you want to remove a disabled attribute in script, use the removeAttribute() method.

http://www.w3.org/TR/REC-html40/intro/sgmltut.html#didx-boolean_attribute-1
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66491
160
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Jon Hanlon:
In HTML boolean attributes such as disabled and readonly can only legally take the name of the attribute.



I beleive that the OP was talking about Javascript properties (which will expect Javascript boolean values) rather than assigning HTML attributes, but this is a good point for those that will be assigning these values in HTML.
 
Jon Hanlon
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you script

then the non-empty string is cast as boolean true, so it becomes
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66491
160
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, as I said. In script, a boolean value is expected. What's your point?
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Jon Hanlon:
Well, if you script

then the non-empty string is cast as boolean true, so it becomes



That's a good point.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!