How to disable a textarea which is dynamically added to the HTML?
HTML:
<div class="ss_datesel_inp_cont">
<div class="ss_datesel_inp_right_corner">
</div>
<input autocomplete="off">
</div>
This is what I tried:
$('.ss_datesel_inp_cont:textarea').prop("disabled", true);
$('.ss_datesel_inp_cont:input').prop("disabled", true);
I don’t see a textarea element in the code you posted? Based on the markup you have, you would disable the input by:
The reason your code isn’t working is simply because the selector is wrong. The input is a descendant of
.ss_datesel_inp_contand therefore you need to indicate that with a space between.ss_datesel_inp_contandinput. The input is also a direct child, so alternatively you could use the direct child token>as in$('.ss_datesel_inp_cont > input').