Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Why this function doesn’t work in ‘for loop’ ? [jquery] Re: Why this function doesn’t work in ‘for loop’ ? [jquery]

#127657
pixelgrid
Participant

the $(‘#input’+j).focus() function registers event listeners for all the inputs 1-5 and runs on page load after that the k value remains 5, but the function inside .focus() runs once the first input gets focus.At that time it only enables the fifth row because of the k value.

my code depends on getting the number after the #input to do that i used .match() that returns an array with each match. in our case is only one match so the first element is the number