我需要在 jQuery .html() 函数中打印一个 var。我该怎么做?
.html('<table><tr><td><!-- VAR PRINT HERE? --></tr></td>')
最佳答案
假设您的变量在 JavaScript 中:
.html('<table><tr><td>' + variable_name_here + '</tr></td>')
这只是连接(添加、粘合)第一个字符串,然后是您的变量,然后是第二个字符串。
关于jquery - 如何在 jQuery .html() 函数中打印 javascript 变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5446880/