简体   繁体   English

在html标签中动态附加文本

[英]Appending text dynamically in a html tag

I have a html tag in javascript block as follows: 我在javascript块中有一个html标记,如下所示:

 html += '<th><div></div></th><tr style="width:100%">';

 I want to insert var.value in between div , but there is an error


html += '<th><div>"+var.value+"</div></th><tr style="width:100%">';.

Whats the correct way of inserting variable. 什么是插入变量的正确方法。

replace it with 替换为

html += '<th><div>' + var.value + '</div></th><tr style="width:100%">';.

Basically replace double quote " with single quote ' 基本上将双引号"替换为单引号'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM