I'm generating this HTML on .cs side :
<table>
<tr>
<td>Product</td>
<td>Price</td>
<td>Destination</td>
<td>Updated on</td>
</tr>
<tr>
<td>Oranges</td>
<td>100</td>
<td><a href="#" class="toggler" zzz="1">+ On Store</a></td>
<td>22/10</td>
</tr>
<tr class="cat1" style="display:none">
<td></td>
<td>120</td>
<td>City 1</td>
<td>22/10</td>
</tr>
<tr class="cat1" style="display:none">
<td></td>
<td>140</td>
<td>City 2</td>
<td>22/10</td>
</tr>
</table>
And by calling the controller with Ajax I add the HTML to the page like this :
$.ajax(
url:"/MainController/HTMLGenerator",
success : function (data) {
$('#mydiv').html(data);
})
I also have this JS code to toggle rows :
$(".toggler").click(function(){
$('.cat'+$(this).attr('zzz')).toggle();
});
But no matter what I do, I couldn't get the link working. I guess it happens because HTML is generated at the backend. I don't know how to solve this though. Thanks in advance.