How to disable a text area?
I don't see a textarea element in the code you posted? Based on the markup you have, you would disable the input by:
$('.ss_datesel_inp_cont input').prop('disabled', true);
The reason your code isn't working is simply because the selector is wrong. The input is a descendant of .ss_datesel_inp_cont
and therefore you need to indicate that with a space between .ss_datesel_inp_cont
and input
. The input is also a direct child, so alternatively you could use the direct child token >
as in $('.ss_datesel_inp_cont > input')
.
To change the disabled property you should use the .prop() function.
$("textarea").prop('disabled', true);
$("textarea").prop('disabled', false);
Note: For jQuery 1.6+