如何在 javascript 数组中写入 html 的锚元素?

How to write an anchor element of html within a javascript array?

我必须创建一个 Javascript 数组,其中一个元素是:

删除

问题是如何用引号引起来?我已经在其中使用了单引号和双引号。

现在,数组行如下所示:

['39','190507hdyq9o','<a href="http://localhost/cmhs_app/index.php/patient/view/39">DEBI PRASAD CHATTERJEE</a>','66','8670079226',' '<a class="btn-sm btn-danger" href="http://localhost/cmhs_app/index.php/patient/delete/39" onclick="return confirm(\'Do you really want to delete this Patient?\')">Delete</a>'],

这行不通。

这应该有效:

var arr = ['<a class="btn-sm btn-danger" href="http://localhost/xyz/index.php/item/delete/39" onclick="return confirm(\'Do you really want to delete this Patient?\')">Delete</a>'];

console.log(arr[0]);