tags:

views:

46

answers:

1

I have a button which should be disabled when the JSP page loads.

How do I achieve this?

+1  A: 

If there is no any specific conditions for disabling button, you can use HTML attribute disabled. Like this, instead of dynamically changing it on load.

<input type="button" disabled="disabled" value="My button" name="btn1" />
Artem Barger
The only value the disabled attribute can have is "disabled", "true" is not a valid value.
David Dorward
You correct, fixed it.
Artem Barger
@David Dorward: Incorrect, on w3.org the disabled attribute is listed as a **Boolean**.
animuson
@amimuson, take a look http://www.w3schools.com/TAGS/att_button_disabled.asp
Artem Barger
I wouldn't cite w3schools over the W3C... @animuson http://www.w3.org/TR/html401/intro/sgmltut.html#didx-boolean_attribute `Boolean attributes may legally take a single value: the name of the attribute itself (e.g., selected="selected").`
deceze
@deceze: Thanks for clearing that up, I was looking at an XHTML sheet that only listed the attribute as a Boolean without explanation.
animuson