I have a table with items in a row, each item have a button.
I want to click on that button and get the values from my item. Like "You have clicked button1 and the name of you item is item1"
Oh, ofcourse I do this in a repeater and the I have the primarykey as the tr id.
I have a jsfiddle example that my explain more, right now the only working thing is that when I click on the button it shows the buttonname.
Thanks in advance!
Html
<table id="presTable">
<tr>
<th></th>
<th>
Name
</th>
<th>
Adress
</th>
</tr>
<tr id="Name0" class="itemRow">
<td>
<input type="button" class="ss" id="Button0"
value="Test"/>
</td>
<td>
<span id="nameSpan">Name0</span>
</td>
<td>
<span id="spanAdress"> Adress0</span>
</td>
</tr>
<tr id="Name1" class="itemRow">
<td>
<input type="button" class="ss" id="Button1"
value="Test"/>
</td>
<td>
<span id="nameSpan">Name1</span>
</td>
<td>
<span id="spanAdress"> Adress1</span>
</td>
</tr>
<tr id="Name2" class="itemRow">
<td>
<input type="button" class="ss" id="Button2"
value="Test"/>
</td>
<td>
<span id="nameSpan">Name2</span>
</td>
<td>
<span id="spanAdress"> Adress2</span>
</td>
</tr>
</table>
Jquery
$(function () {
$('tr.itemRow > td > input.ss').each(function (row) {
$(this).click(function (button) {
alert("You have pushed the button " + $(this).attr("id"));
});
});
});