Making table rows generated via JQuery act as onClick page redirects <p>So I am pretty new to JQuery/HTML development of all kinds. Basically I am working on a project where I make an AJAX call that gets a bunch of usernames, dates, etc. regarding Craiglist-like sales that I put into a table format dynamically using JQuery and DOM.</p> <p>I want to be able to make these elements in the table act as links so that if I click on a certain username, it will take me to their profile. I've tried different suggestions out there but none of them are for tables that are generated with JQuery and I think this is causing problems (but I don't think there is any way around that either). Some snippets of my code are as follows:</p> <pre><code>function displayCurrentSales(description, seller, date) { var sale = document.createElement("p"); var table = document.getElementById("currentSalesTable"); var row = table.insertRow(-1); var descriptionRow = row.insertCell(0); var userRow = row.insertCell(1); var dateRow = row.insertCell(2); descriptionRow.innerHTML = description; userRow.innerHTML = seller; userRow.onClick = "window.location.href = '../profilePage/index.html?username=' + seller;"; dateRow.innerHTML = date; } </code></pre> <p>This is my code that I started with except for the userRow.onClick part which I added to try and make it work. </p> <p>Any help is appreciated, Thanks.</p>