Over the past couple of weeks I’ve stumbled over the same issue with jQuery a number of times. When you’re in an each loop within jQuery or some other reason when you’re using $(this), I continually have problems with finding and selecting a parent of $(this)
After a bit of searching, I’ve come across a lifesaver function built into jQuery. Closest()!
Quite simply…
$(this).closest('.class-name')
Seems to be working pretty good so far!
tnx from a newbie
This function is working great with this j query development. I have been implemented this stuff in my project and it is beneficial for me. so thanks for this update.