I have this:
<div id="pic_pin">
<div id="selected_picture">
<img src="map.png" />
</div>
</div>
I add a marker picture on clicking the map image:
$('#selected_picture').on('click', function(e){
offset = $('#selected_picture').offset();
x = e.pageX - offset.left - 25;
y = e.pageY - offset.top - 25;
var pin = $('<div class="pin"><img class="pin-img" data-left="' + x + '" data-top="' + y + '" src="pin.png" /></div>');
pin.uniqueId();
$('#pic_pin').append(pin);
pin.css('left', x).css('top', y).show();
});
Then on clicking the marker image (div) I want to open a pop-up:
$('#pic_pin').on('click', '.pin', function(e){
console.log('log: '+e.target.id);
...
});
And the problem is the e.target.id is empty - it simply shows 'log: ', no id
is shown. Why?