【问题标题】:How to write an anchor element of html within a javascript array? [duplicate]如何在 javascript 数组中编写 html 的锚元素? [复制]
【发布时间】:2019-06-23 16:45:20
【问题描述】:

我必须创建一个 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>'],

这不起作用。

【问题讨论】:

    标签: javascript arrays anchor


    【解决方案1】:

    这应该可行:

    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]);
    

    【讨论】:

    猜你喜欢
    • 2016-11-12
    • 1970-01-01
    • 1970-01-01
    • 2011-09-04
    • 2020-02-12
    • 2021-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多