adworldmedia
asked on
Javascript Open Wizard on click event from dynamic data
With some C# code, I'm building a Table including a <DIV> tag that I've added a value to that refers to an object ID.
The table will have multiple rows, each having a different object ID, and its own unique <DIV> tag, ie:
I want to be able to use Jquery or Javascript to retrieve the value of which DIV was clicked... How would I do that?
The table will have multiple rows, each having a different object ID, and its own unique <DIV> tag, ie:
<table>
<tr>
<th>Function</th>
<th>Name</th>
<th>ID</th>
</tr>
<tr>
<td><div id='edit' value='1234'>Edit</div></td>
<td>Object One</td>
<td>1234</td>
</tr>
<tr>
<td><div id='edit' value='1235'>Edit</div></td>
<td>Object two</td>
<td>1235</td>
</tr>
I want to be able to use Jquery or Javascript to retrieve the value of which DIV was clicked... How would I do that?
var wizard = $("#campaignWizard").wizard();
$("#edit").click(function () {
var clickedID = {????};
wizard.show();
});
with a class : http://jsfiddle.net/bkjb1u9t/2/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
from julianH code, you should read, line 8, data-id instead data-d
@leakim - thanks for catching that
In you case use a class instead.
Test page : http://jsfiddle.net/bkjb1u9t/1/
For teh sake of your question, use :
Open in new window