Please help~
There are order lists. When I put any number into input box, the number list changed color into red. For example, if I put number 1 into input box, lists of number1(1.a)should be changed the color into red. The problem is color changed following by index. If I put number2, lists of number 3(3.c) is changing instead of number 2(2.b). How can I fix it? Also, how can I remove red color after clear the input field, so that I can type new number again and the color change again. Please help~~ Html. <ol id="list-container"> <li>a<li> <li>b<li> <li>c<li> <li>d<li> <li>e<li> </ol> <input type="text" id="number" autofocus> <button id="changeColor">color Change</button> Jquery var lists=$("li"); $("#changeColor").click(function (){ var num=$("#number").val().split(","); $.each(num,fucntion(i){ lists.eq(num[i]).addClass("red"); $("#number").val(""); }); });