Hi! I have a problem :) .... Why when i compare input value with array, he match only the first input. this is my code
$(function(){ var prova = new Array(); prova[0] = "Z"; prova[1] = "G"; prova[2] = "N"; $('#prova').text(prova.join(", ")); var i =0; $('input').click(function(){ $('#lettere').hide("slow"); $('#scrivi').hide("slow"); while(i<prova.length){ $('#prova').append("<input type=\"text\" name=\""+prova[i]+"\" size=\"1\" id=\"testo" + i +"\" value=\"\"/>"); i++; } $('#prova').append("<br /><input type=\"submit\" name=\"inserito \" value=\"OK\" />"); $("input[name='inserito']").click(function(){ var k = 0; while(k<prova.length){ if($("input[id*='testo']").val() == prova[k]){ $('#esito').text("ok fattas").show(); //return true; }else{ $('#esito').text("niente").show(); $('#esito').append(" " +prova[k]); return false; } k++; } }); }); }); </script> </head> <body> <div id="es1"> <div id="scrivi"></div> <div id="lettere"> <form action="#"> <input type="submit" value="ok" /> </form> </div> <div id="prova"> </div> <div id="esito"></div> </div> sorry for my bad english and thanks for help!