You could use event delegation on the parent div. Or use the closest method to find the parent of the button.
The easiest of the two is probably the closest.
var id = $("button").closest("div").prop("id");
More Related Contents:
- jQuery find events handlers registered with an object
- What is the difference between jQuery: text() and html() ?
- jQuery – Trigger event when an element is removed from the DOM
- Get an element by index in jQuery
- jQuery event for images loaded
- Rotating a Div Element in jQuery
- How can I run a directive after the dom has finished rendering?
- jQuery html() in Firefox (uses .innerHTML) ignores DOM changes
- JQuery to check for duplicate ids in a DOM
- Is it possible to use jQuery to read meta tags
- jQuery: select an element’s class and id at the same time?
- How do I get the entire page’s HTML with jQuery?
- Events not registering after replaceWith
- Iterating over element attributes with jQuery
- AngularJS: $viewContentLoaded fired before partial view appears
- How to get form html() via jQuery including updated value attributes?
- Get the selected option id with jQuery
- Dynamically adding HTML form field using jQuery
- How to destroy a DOM element with jQuery?
- addClass and removeClass in jQuery – not removing class
- How to change the bootstrap css width into 1000px? [closed]
- How to fire loadComplete after new row is added in jqgrid?
- How do I change selected value of select2 dropdown with JqGrid?
- Choosing a jQuery datagrid plugin? [closed]
- Can jQuery add commas while user typing numbers?
- How can I remove script elements before they are being executed?
- jQuery Validation plugin won’t validate when in click event handler of
- How to make my ‘click’ function work with iOS
- bootstrap-typeahead.js add a listener on select event
- jQuery trigger custom event synchronously?