I am generating HTML dynamically through javascript and have 2 glyphs enclosed within a table cell. The pencil glyph responds correctly however my code for the delete does not and I am not sure why.
This is the rendered HTML
<span id="edit-dp" class="glyphicon glyphicon-pencil" data-action-url="/Settings/GetDatapoint" data-id="3"></span>
<span id="delete-dp" class="glyphicon glyphicon-trash" data-id="3"></span>
and here is my javascript code to tie the event up to the element.
$(document).ready(function(){
$('#delete-dp').click(function (event) {
alert('pressed');
//add the datapoint ID to the array to be serialised to JSON and then stored in a html hidden field
deletedDatapoints.push($(this).data('id'));
});
})