My javascript
$(".controls").click(function(event) {
var div = $(event.target).parents(".controls");
var a = $(div).find("tr .select");
return false;
});
And html
<div id="grid1" class="controls">
<a href="/projekt/create">Add</a>
<a href="/projekt/edit">Edit</a>
</div>
<div id="grid2" class="controls">
<a href="/uloha/create">Add</a>
<a href="/uloha/edit">Edit</a>
<table>
<tr id="1"></tr>
<tr id="2" class="select"></tr>
<tr id="3"></tr>
</table>
</div>
I’d like to select the first TR which has class select.
I’ve tried
var a = $(div).find("tr:first .select");
or
var a = $(div).find("tr .select:first");
but none of them worked.
You could try this:
or
Since there’s :first and first().
To select all of this within that you use:
Would something like this work?
This changes “two” to okay, but not ‘four” when you press the button.
(As a side note, those are not proper id names, they cannot start with a number if you want valide html)