|
-
Sep 2nd, 2004, 02:41 PM
#1
Thread Starter
Frenzied Member
the disabled attribute in XHTML [resolved]
I've used JS to change the disabled attribute quite a bit. I use disabled="disabled" to disable something and disabled="" to enable it. I found that MSDN says you should use true/false, but then this page on the W3C says you should use what I use for dissabling them. I tried setting disabled="" and disabled="false" and disabled="enabled". None of these were allowed by XHTML1.0 Strict or transitional. What's the right way of doing this? I realise that you can simple leave out the attribute, but when changing it wil JS what should you set it to?
Last edited by Acidic; Sep 2nd, 2004 at 04:06 PM.
Have I helped you? Please Rate my posts. 
-
Sep 2nd, 2004, 03:01 PM
#2
Frenzied Member
Well... I'd say if you're expecting it to work in IE, better go by what MSDN says. Now... if you want to do it the RIGHT way... then do what the standard says.
-
Sep 2nd, 2004, 03:57 PM
#3
Fanatic Member
Omit the disabled attribute entirely if you don't want to have the textbox disabled. Delete the attribute with JavaScript (removeAttribute).
In "old" HTML you only had to type "disabled" if you wanted to disable a form control. I've understood that for XHTML all those single-worded statements should be expanded to ' statement="statement" ', and if it doesn't occur, then just leave it out.
-
Sep 2nd, 2004, 03:59 PM
#4
Fanatic Member
If this doesn't work for IE, I'm afraid you need to include some object detection to determine in which browser your code is running...
-
Sep 2nd, 2004, 04:02 PM
#5
Thread Starter
Frenzied Member
sorry for not clearing up. both the old style, the true/false method and "disabled"/"" work in all browsers I've tried. I was just looking for how to do it following the standards, thanks for the reminder on removeAttribute, I had totally forgotten about that one as I have never actully used it. That would be the way to go.
Have I helped you? Please Rate my posts. 
-
Sep 3rd, 2004, 04:07 AM
#6
The XHTML attribute disabled should be set to "disabled" to disable and to "" (or removed) to enable.
The JavaScript property disabled should be set to true or false.
If you use setAttribute in JavaScript, use the values for the attribute.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 3rd, 2004, 04:10 AM
#7
Thread Starter
Frenzied Member
Originally posted by CornedBee
The XHTML attribute disabled should be set to "disabled" to disable and to "" (or removed) to enable.
If you leave it blank, then it's not valid. Otherwise thanks a lot for that.
Have I helped you? Please Rate my posts. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|