Im havin problems in selecting my first 2 td of every tr(i need to make them lickable) and my last td of every tr(different links). Can someone help me with the code? I cant seem tofigure it out. The code seems legit but it doesnt work. Here is the js and html:
JS
$(".rand_notif td:lt(2)").click(function(){
$(".rand_notif").html("asd");
})
HTML (somehow..still js but html)
$.each(data.notif,function(i,x){
var cant='';
if(x.cant>0){var cant = x.cant+"x";}
notificari+="<tr class='spacer_2'></tr><tr class='notificari rand_notif' record='"+x.id+"'><td>"+cant+"</td><td>"+x.nume+"</td><td>Refuz</td></tr>";
});
Actual html
<table cellspacing="0" id="tabel_notificari">
<tr class="spacer_1"></tr>
<tr class="table_head notificari">
<th width="30"></th>
<th>Notificari</th>
<th width="86"></th>
</tr>
</table>
EDIT: Problem solved. The problem was, as explained in the comments, the fact that the elements were first binded then added, therefore the bind didnt exist. Solution:
$("#tabel_notificari").on("click", ".rand_notif td:lt(2)",function(){$(".rand_notif").html("asd");});