I’m having trouble selecting for an element on my DOM.
How do you select for all links of the td class trash can?
<td class="trash_can">
<a rel="nofollow" data-remote="true" data-method="delete" data-confirm="Are you sure you want to delete Greek Theater at U.C. Berkeley?" href="/promotions/2/places/46">
<img id="trash_can" src="http://test.dev/images/trash.png?1305741883" alt="Trash">
The following code does nothing and is not working:
$(function(){
$('.trash_can').live("click", function(event) {
console.log('Clicked Delete');
event.preventDefault();
});
});
.trash_canselects yourtd, not itsa. You want to apply the event handler to theaelement.