I'm stuck with my small jQuery script. I want to make checkboxes for the rows of a specific table. This would be a greasemonkey script, so I can't edit the source of the site.
This is how the HTML is set up:
<html>
<head></head>
<body>
<table class = test1></table>
<table class = test2></table>
<table class = goal>
<thead>
some some <tr>
</thead>
<tbody>
here are the table rows where I want to put the checkboxes
</tbody>
</table>
</body>
</html>
The problem is that, is puts checkboxes in the rows at every "tr" what it can find in all the tables. And finally my code:
var $ = unsafeWindow.jQuery
$(document).ready(function (){
$("table.goal").ready(function(){
$("tbody").ready(function(){
$("tr").prepend('<td><input type="checkbox" name="x" value="y"></td>');
});
});
});
Please, someone would be so kind to explain me, why this isn't working as intended? Thanks in advance.