The issue is that I'm trying to select elements with $("a") and its affect only few of the tags in the document, my code
$(document).ready(function() {
$.ajax({
type: 'GET',
url: 'http://localhost/queryProjects',
success: function(data) {
var el = $('<div></div>');
el.html(data);
var ProjectsObject = $("b:contains('projectName')", el).parent().next();
var ProjectsArray = $.makeArray(ProjectsObject);
var DescriptionsObject = $("b:contains('description')", el).parent().next();
var DescriptionsArray = $.makeArray(DescriptionsObject);
for (var i = 0; i < ProjectsArray.length; i++) {
$("tbody:last-child").append('<tr><td>' + (i + 1) + '</td><td><a id="link" href="#">' + ProjectsArray[i].textContent + '</a></td>' + '<td>' + DescriptionsArray[i].textContent + '</td><td style="margin-right=40px;"><a href="#">Run</a></td></tr>');
}
}
});
$("a#link").click(function() {
$("table").hide();
});
});
I have tried with an ID and without, like $("a") and $("a#link").
the AJAX is irrelevant but just so you see how I inject my info to the document.
Thanks!