Goal: read in the current value of a set of text boxes. if the value is "None" replace the value with the value provided. Once a value is changed stop.
When I use span and .text() instead of a textbox and .val() everything works. However, the textboxes are part of a form.
Any idea why it would return as "undefined"?
(basically i'm making a list from user input)
html:
<input type="text" name="class1" value="None" ><br>
<input type="text" name="class2" value="None" ><br>
<input type="text" name="class3" value="None" ><br>
<input type="text" name="class4" value="None" ><br>
<input type="text" name="class5" value="None" ><br>
jquery:
function compareClass(a)
{
var input = a;
for(x=1;x<6;x++)
{
var classText = $('.class'+x).val();
if(classText == "None")
{
$('.class'+x).val(input);
break;
}
}
}