(Hi Dr.Nick)
I am pretty new to JavaScript and still i'm trying to build a website with asp.net EF JavaScript and so on...
I have genereated links from the information I have in my database and I want the name of that link to appear in my textbox but as you can see from this picture, no matter what link I press I will get entity... (if i press alfk i get entity).
My links get generated like this (for each entry in database):
<span>
<a id="myLink" title="tagLink" value = @i.ID
href="PleaseEnableJavascript.html" onclick="MyFunction();return false;">@i.Name</a>
</span>
and my JavaScript looks like this:
$( '#myLink' ).click(function () { MyFunction(); return false; });
function MyFunction() {
document.getElementById( 'textTemp' ).value += document.getElementById( 'myLink' ).text + " ";
}
We can all see the problem... All my links have the same ID thus javascript will take the first one... But how do I solve this problem?