jQuery(document).ready(function($) { $("img").click(function(){ var id = $(this).attr("data-source"); alert(+id); }); });