Using jquery, you can easily target all the elements which have a specific class and assign an onclick event to it as shown below:
$(".photo_class").click(function(){
alert("Finally!")});
If you want to target a specific element which has an id, then you can use the below call:
$("#photo_element_id").click(function(){
alert("Finally!")});