Hi , I m learning jquery and I m stuck at a point.
Im creating a form and I want the fields to appear when the user focus on the input fields. http://codepen.io/sayed2x2/pen/urkhp
The function is working fine, which is very simple
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
Today I learned a very basic essential thing of jquery from you, which I m sure will help me a long way understanding the logic. Now I understand why my code wasn’t working but im sorry for being dumb to understand your code.
What I understand in $(this).attr(‘id’).match(/d+$/) you are grabbing hold of the number which is coming under the attribute ‘id’ . but the regular expression (/d$/)) was enough to match the number then why did you use match(/d+$/) and then why the first element of the array ‘’.
And then (+num+1). I m really sorry , im a beginner in jquery and it going from top of my head. I would be really thankfull to you if you explain it a little more.
Again sorry for begin dumb.