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]

#127660
sayedtaqui
Member

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+$/)[0] 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+$/)[0] and then why the first element of the array ‘[0]’.
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.