I am trying to submit HTML forms whenever a text input is entered so I have-
<script type="text/javascript">
$("#HA15CRNK13").blur(function() {
$("#HA15CRNK13A").submit();
});
$("#HA15VSPS13").blur(function() {
$("#HA15VSPS13A").submit();
});
</script>
The above works. However, I will like to achieve the same result in a for loop i.e
<script type="text/javascript">
var T = ['#HA15CRNK13','#HA15VSPS13'];
var arrayLength = T.length;
for (var i = 0; i < arrayLength; i++)
{
var J = '"'+ T[i]+'"'; // id of input text element
var P = '"'+ T[i]+'A'+'"'; // id of the form to submit
$(J).blur(function() {
$(P).submit();
});
}
</script>
The above doesn't work. How do I go about this? Thanks.