JavaScript
Article

jquery get parent element with specific class

By Sam Deering

Quick jQuery snippet to get parent elements with specific class.

var container = $(this).parents('.item');

No Reader comments

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.