determining which element is clicked

determining which element is clicked

 In my html head tag i have a script like as below


$ ( function ( ) {
 
    $ ( 'img' ). click ( function ( ) {

....


$. ajax ( {
                        url: 'somepostusrl,
                        data: dataString,
                        beforeSend: function ( ) { $. loading ( { text: 'Wait!', pulse: 'working', mask: true, max: 2500, delay: 20, align: 'center', img: '{{=URL(request.application,'static ','ajax-loader. gif ')}}' } ); },
                        complete: function ( ) { location. reload ( ); },
                        success: function ( ) { alert ( "done" ); }
                } );
                return false;

....




    });

I am trying to update some values on the page when an img is clicked. There are many img tags on the page. I am not sure how can i determine which one is clicked. Can someone give me an idea?

Do i have to add an onclick event to my img tags with some id parameter or is there a possibility to detect which element is clicked on the page without calling a function?

How can i carry the above code to an external js? I am not sure also about the $( part meaning.

Will be happy if someone guides me a little.