Using THIS jQuery selector in a onclickevent function
-
Hi,
I have been using jQuery selector extensivly in my project but the THIS selector is causing me problems. The answer must be straightforward but… not for me !
I have a button inside a
personnel
class fieldset. This fieldset is duplicated 20 times with the same button in each one. The button calls the resetpersonnel() function here below. I would like theindexpersonneltobedeleted
variable to give the index of thepersonnel
fieldset that has been clicked.It seems that I’m not using the THIS selector the right way.
I appreciate if you can help me with this.
function resetpersonnel() { var indexpersonneltobedeleted = jQuery('.personnel').index(jQuery(this).closest('.personnel')); ... }
Best Regards,
Skander
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Using THIS jQuery selector in a onclickevent function’ is closed to new replies.