jquery - alert the value of an element on click of link Ajax -
how can alert value
of element onclick
of link here? simple alert not working inside , don't want use console.log()
var row = ''; $.each(result, function(index, element) { row += '<tr>'; row += '<td>' + '<a href="" onclick="alert value here(alert(element.name)">' + "link" + '</a>' + '</td>'; });
save value in "data" element in link , later use value @ runtime when make click: example on fiddle
var row = ''; $.each(result, function(index, element) { row+='<tr>'; row += '<td>' + '<a data-name=' + element.name+ ' href="" onclick="alert($(this).data(name));">' + "link" + '</a>' + '</td>'; });
Comments
Post a Comment