I have a page with a bunch of tables that all share a class. I'd like to be able to add a click function to each of them using GreaseMonkey. The script runs but only the first table ever seems to work. Clicking on it causes a message to be logged, the others do nothing.
Here's my GreaseMonkey script:
$(document).ready(function(){
$('.data').click( function() {
console.log( "clicked" );
return false;
});
});
Sample HTML:
<div>
<table class="data" id="125232">
...
</table>
<table class="data" id="252123">
...
<table>
<table class="data" id="125234">
...
</table>
</div>
So in this case, only the table with id 125232 has a working click function.