AJAX retrive attribute value from loaded content
I load data to a div dynamically
- $.get(test.php, { cmd: cmd, id: id},function(data){$('#files '').html(data);});
The retrieved data is in a table and looks like this
- test.php
- <table class="files_table">
- <tr eID='1'>
- <td> Content # 1</td>
- </tr>
- <tr eID='2'>
- <td> Content # 2</td>
- </tr>
- </table>
Now I wan't to be able to by clicking on my div to retrive the selected 'eID' attribute.
I have something like that on my parent site where my div "files" is placed
- $('#files table.files_table tr').click(function(){alert($(this).attr('eid'));});
It works only once... After refreshing site it doesn't.
I was searching the net for a couple of hours, but I guess I might have been looking for the wrong thing...
Any clues on how to fix it ?