连上数据库之后,填充数据时往往需要在js中插入html语句
做法是:
<body>
<div class="modal-body" id="deleteModalLabel" style="color: black;font-size: large;">
var str=‘data-dismiss=‘modal‘>取消‘
$(‘#deleteModalLabel‘).html(str);
</script>
即把要插入的html语句存在字符串里面,然后用$(‘#id‘).html(str);
上面的做法也可以这样:
<script>
$(‘#deleteModalLabel‘).html(‘data-dismiss=‘modal‘>取消‘ ‘);
</script>
在js中插入html语句
原文:https://www.cnblogs.com/lsyy2017/p/10425676.html