无法将var值连接到内部html



我试图显示一个在innerHTML中附加变量值的对话框,但到目前为止我所做的似乎不起作用。

var srcValue = "";
srcValue = testValue;  //Some other function in my code sets the value for srcValue 
var pathNotFound = new Coral.Dialog().set({
id: 'pathNotFound',
variant: 'error',
header: {
innerHTML: 'No match found'
},
content: {
innerHTML: srcValue + ' does not exist in the source path.'
}
});

对话框的内容部分显示->quot;在源路径中不存在">

而不是->quot;源路径中不存在testValue">

我试过

content: {
innerHTML: String(srcValue) + ' does not exist in the source path.'
}

这也不起作用。

同时,如果我使用与以下代码相同的代码,它会起作用;

var srcValue=";testValue";;

我们非常感谢您对如何使其发挥作用的任何帮助。

console.log((srcValue,并让我们知道它的输出。上面的评论可能是正确的。它不会返回值。也发布该功能。

最新更新