title: How to get a anchor link text inside a javascript and calling with arguments
body: <p>I wrote a function like to get a user from server and i got it . Now i create a links for each users using <code>a href</code> inside <code>java script</code> . This is working fine . Now i want to execute a function when i user click the link (with the corresponding user name)</p>
  
  <pre><code>var User_id = document.querySelector(".sidebar-name");
  
  //getting array of user
  
  function list(user){
  
     User_id.innerHTML = "";
  
     for( i = 0; i &lt; user.length; i++ ){
  
        User_id.innerHTML+= "&lt;a href='#' onclick = 'javascript:calluser(this);' style='text-decoration:none'&gt;" + user[i] + "&lt;/a&gt;" + "&lt;br /&gt;"; 
  
      }
  }
  
  
  
  function calluser(this){
  
    alert(user);
   // i need to print the corresponding username or anchor text .
  // how can i solve this ? 
  
  }
  </code></pre>
  
  <p>I tried with <code>id</code> inside <code>a href</code> . But this is not unique so it won't work . How can i solve this ? </p>