JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id = 'yyyy' onkeyup = 'check(this.value)'></textarea>
<textarea id = 'xxxx' onchange = 'check2(this.value)' readonly></textarea>
JavaScript
//Is not changable according to OP
function check(value){
document.getElementById('xxxx').value = value
};
//Is not changable according to OP
function check2(value){
alert(value)
};
window.onload = function(){
var tE = document.querySelector('#xxxx'); //The readonly textarea
//Redefine the value property for the textarea
tE._value = tE.value;
Object.defineProperty(tE, 'value', {
get: function(){return this._value},
set: function(v){
this._value = v;
this.innerHTML = v;
this.setAttribute('value', v); //Setting the attribute (browser stuff)
check2(v)
}
})
}