Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:





function myfunc(){
var a=document.getElementById("one");
var b=document.getElementById("two");

for(var i=0;i<=a.length;i++){
if(b[i].value == a[i].value){
b[i].style.color = "yellow";
}
else if(b[i]!= a[i]){
b[i].style.color="red";
}
}

}



What I have tried:

i want to run this code,i want to make two input boxes and i apply fixed text to one input box,so in second box when user enters text that is equal to first input text
so the color of second input box by index wise will be yellow else red
Posted
Updated 11-Jan-19 8:45am
Comments
Patrice T 11-Jan-19 13:47pm    
"i want to run this code"
Ok go on.
If you have a question, state it.

1 solution

You can learn about HTML input here: HTML Forms[^]
Then copy your code and test your Javascript at: Create a new fiddle - JSFiddle[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900