I have a table where the first cell on every row contains a link. When the user mouseclicks on a row I want the link on the same row to get focus().
I want to do this with an Angular directive. I'm using Angular but I think the solution comes down to jQuery usage.
This is a simplified version of what I've got now:
<div ng-app="app">
    <table border="1" focus-on-link-please>
      <tr>
        <td><a href>Link A</a></td>
        <td>Some text</td>
        <td>Some text</td>
      </tr>
      <tr>
        <td><a href>Link B</a></td>
        <td>Some text</td>
        <td>Some text</td>
      </tr>
    </table>
</div>
JS:
var app = angular.module('app', [])
app.directive('focusOnLinkPlease', function() {
  return function(scope, elem, attrs) {
    elem.bind('click', function(event) {
      console.log('click!')
      event.target.closest('tr').find('a').focus(); // Does not work :(
    });
  }
});
Any tips?
 
     
    