Alexan
Alexan

Reputation: 8635

disable textbox by jquery

I'm trying to disable textbox using jquery:

$('#<%=txtFrom.ClientID %>').attr('disabled', true);

It looks as disabled: image, but actually it's not, I can write there. Why?

UPDATE: Fixed by adding input in the code:

$('#<%=txtFrom.ClientID %> input').attr('disabled', true);

Upvotes: 2

Views: 3332

Answers (1)

red_alert
red_alert

Reputation: 1728

You need to do that:

$('#YOUR_ELEMENT_ID').attr("disabled", "disabled");

Upvotes: 1

Related Questions