I have inserted an image (with <a> tag) like "Add to cart" before the title of list item using SP Designer. Now I want to check that which item's link is clicked using java script. How to do that?
My code is:
<script type="text/javascript">
function Clicked()
{
alert("You have clicked link");
return false;
}
</script>
<a href="#" onclick="return Clicked();" title="Add item to cart"><img alt="Add to cart" src="file:///C:/Users/Kalpesh.Vaghela/Desktop/add-to-cart-web-button-9227672.jpg"></img></a>
<xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping ="yes"/>
return Clickedis the optimal use in theonclickevent? I advice you to use<a href="javascript:void(0)" onclick="Clicked()">instead as it makesreturnredundant/unneeded.