How can I dynamically add a row that contains HTML elements?

How can I dynamically add a row that contains HTML elements?

julian1942julian1942 Posts: 1Questions: 1Answers: 0

Hello,

I'm adding a new entry to my database with AJAX and then adding it to the datatable like this:

let href = $('<a href="/an/amazing/url" class="btn btn-light-danger"><i class="bx bx-trash"></i>'<span>Delete</span></a>');
$(table).DataTable().row.add([
data.id,
data.name
href
]).draw();

The row is added successfully.
My problem is with the "href" element. Instead of rendering as an HTML element, only the URL is displayed in plain text. How can I rend the whole "href" as HTML?

Answers

This discussion has been closed.