JS 三层引号嵌套使用

1、第一层单引号,第二层双引号,第三层转义单引号

$("#test").html('<input type="button" value="按钮" onclick="alert(\'123a\')"/>');

2、第一层双引号,第二层单引号,第三层转义双引号

$("#test").html("<input type='button' value='按钮' onclick='alert(\"123a\")'/>");

 注:

(1)第三层转义引号要和第一层引号一致。例如,第三次转义引号为双引号,那么第一层也要为双引号。

    原文作者:旭东怪
    原文地址: https://blog.csdn.net/qq_38974638/article/details/108609284
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞