Get the input value of "ANY" not first matched ele

Get the input value of "ANY" not first matched ele

Hi Guys,

I am having difficulty getting the value of a specific value contained in a <p> tag. What is happening is that it retrieves the value of the first <p> tag value and not the on the user clicks.

What I need is to retieve the value from the <p> tag the user click.

Snippet code:

$(document).ready(function() {   
                   
   $("p").click(function () {
   var prop = $("#property_links").val();
   $.post("n10-shortlist-connector.html", { web_AGENT_REF: prop});
         var htmlStr = "Added to Compare Tool";
       $(this).text(htmlStr);
                     });
                        
                  });   


<p><a style="cursor:pointer; color: #900">  Add to Compare Tool <input type="hidden" id="property_links" value="<? echo $AGENT_REF; ?>"/></a></p>      //    many of these tags on the page


view page: http://nwbeta.itproz.co.uk/residential-lettings.html?typ=2&p=1&ppp=10&location=Liverpool
If viewing the site when you click "add to compare list" it will change to "Added to compare list"

All help appreciated,
Thanks in advance.