Reputation: 3998
I have a table with some data and last column has a hyperlink for all the rows in the table. I need to open a dialog on click of the hyperlink.
<table id="tableId">
<tr>
<td>...</td>
<td>...</td>
<td>...</td>
<td>...</td>
<td><a href="">edit</a></td>
</tr>
</table>
$("#tableId tr a[href]").on("click", function() {
console.log("Hello World");
$("<div></div>).dialog({});
});
My console doesn't show hello world probably some error in the jquery code
Upvotes: 0
Views: 94
Reputation: 148110
Closing Quote missing "<div></div>"
$("<div></div>").dialog({});
It is better to give hash #
in href like this,
<a href="#">edit</a>
You code would be
$("#tableId tr a[href]").on("click", function() {
console.log("Hello World");
$("<div></div>).dialog({});
return false;
});
Upvotes: 3