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