Take for example a html like the following:
<html>
<head>
<title></title>
</head>
<body>
<div>
<a class="delete-btn"></a>
</div>
<ul>
<li>
<div>
<div>
<a data-record-id="9">I need to grab this, from a click on 'delete-btn'</a>
</div>
</div>
</li>
</ul>
</body>
<html>
I need to add a click event to the item a that has the class ‘delete-btn’, and grab the data-record-id from the <a></a> that has the data-record-id of 9. This can and will change, and assume I have no possibility of adding the data-record-id to the original delete button.
Basically, I have a list of vitals signs for a date, I want to give the user the ability to delete all signs for a date. All children of the date label will have the same record id, which I need to grab.
Any and all help is greatly appreciated.
Use
I don’t know why do you get that error.
See http://jsfiddle.net/3Zkz9/