i have a textarea where i want to change color automatically
for example : this is my pen my friend
as soon as i enter the above text the keyword=pen should become green color and
keyword=freind should become red as soon it matches
How do i achieve this thing
code is working but half working
function changeText()
{
document.getElementById("text").style.color ="green";
}
</script>
Another Code i have But not Working
var str = 'Connect';
var value = str.includes('Connect');
if(value==str)
{
document.getElementById("text").style.color ="green";
}
else
{
document.getElementById("text").style.color ="red";
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…