Now I would expect this function to only run when clicking on a <a data-popup="true"></a> element however it's running on every <a> click.
(function($) {
$(document).ready(function() {
$('a').data('popup', 'true').click(function(e) {
console.log($(this).data('popup'));
e.preventDefault();
});
});
})(jQuery);