I have some buttons that look [like this.](https://i.stack.imgur.com/HI5CQ.png)

It is a "whitelist" of websites. I'd like for the button to remove the corresponding site from the whitelist. 

However, since these buttons are generated with each addition of a site (entered by the user), I don't know how to get the ElementID to use in my function. 

Here is where the button is generated:

```
  var cellWebsite = document.createElement("td");
  var website = document.createTextNode(array[i]);

  //append cell text to cell, then cell to row (like setting a "stage")
  cellWebsite.appendChild(website);
  row.appendChild(cellWebsite);

  //create a cell & cell text for BUTTON
  var cellDelete = document.createElement("td");
  var button = document.createElement("BUTTON"); //has its own element
  var text = document.createTextNode("x");
  button.appendChild(text);
  cellDelete.appendChild(button);
  row.appendChild(cellDelete);

```

How do I get the ID so I can write a function for when the X button is clicked? Within that function, how can I get the website that corresponds to that button?

I'm making a Chrome Extension and using chrome's local storage, if it matters.