You may try this (it'll disable the textarea when you type Example 2 in any textarea which has an id starting with my_ta_)
$('[id^="my_ta_"]').on('keyup', function(){
var txt = $(this).val();
if(txt.match(/Example 2/)){
$(this).prop('disabled', 1);
}
});
It'll even match the example 2 from Some text Example 1 but example 2.
Example Here.
Update : To initially check for the text example 2 and make it disabled there are other (up voted) answers, pick one that you like but I wrote the code to check textarea when user writes in the textarea and if it finds example 2(in any case/any where) then the textarea will be disabled.
Update :
To re-enable the disabled textarea using a select value
$('[id^="my_ta_"]').on('keyup change', function(){
var txt = $(this).val();
if(txt.match(/Example 2/i)){
$(this).prop('disabled', 1);
}
else $(this).prop('disabled', 0);
});
// works on (re-enables) my_ta_2
$('select').on('change', function(){
var text1 = $(this).val();
$('#my_ta_2').val(text1).trigger('change');
});
Example Here.
Update : Maybe you may try this too (initially check and disable and re-enable on change again)
$('textarea[id^="my_ta_"]').prop('disabled', function(){
return $.trim(this.value.toLowerCase()) == 'example 2'
})
.on('change', function(){
var txt = $(this).val();
if(txt.match(/example 2/i)){
$(this).prop('disabled', 1);
}
else $(this).prop('disabled', 0);
});
// works on (re-enables) my_ta_2
$('select').on('change', function(){
var text1 = $(this).val();
$('#my_ta_2').val(text1).trigger('change');
});
Example here.
textarea.