1

on a page with textbox control, lets say this textbox is disabled on server side page load. What would happen if a javascript tries to set visibility of the textbox to false ?

Edit: Can the textbox be hidden by javascript even though it's disabled ?

TIA

2 Answers 2

1

Yes, setting disabled on the serverside only adds the disabled attribute.

Sign up to request clarification or add additional context in comments.

3 Comments

are you saying disabled textbox visibility can be set to false by javascript ?
You can't set it to false. You need to actually remove the disabled attribute via Element.removeAttribute("disabled") from the textbox on the client-side if you want to enable it. disabled="false" is still disabled. It has to do with older HTML where the attribute used to be just disabled. Because of XHTML you usually see this though disabled="true". But all of these mean it's disabled: disabled="true", disabled="false", disabled="bob", disabled="WTF"
@Wisdom - You can use CSS to hide it regardless of whether or not it's disabled. Either visible: hidden or display: none . Here's an explanation of the difference, devx.com/tips/Tip/13638 . So on IE6+ and other modern browsers you can usually just do this: someElement.style.display="none" or someElement.style.display="hidden" or you can use a framework like jQuery to do this, e.g. $("#someElementId").css("display", "none");
0

controlID.Attributes.Add("disabled", "true");
This disables the control...

controlID.Attributes.Remove("disabled");
This enables the control.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.