[英]Anchor tag is not being recognized when inserted into a dynamically generated cell of a table
我正在尝试在html表的单元格中插入一个锚标记。 下面是代码,不知何故标签未被识别,我没有得到该单元格的超链接。 这个语法有什么问题?
$("#tranTbodyId").append('<tr><td><a href='pageContext.request.contextPath'+"/FciDetailDescription.spr">'+ key+ '</a></td><td>' + value.tradeDate+
请提供您的建议。 谢谢大家。
有语法错误,应该像这样使用
$("#tranTbodyId").append('<tr><td><a href="'+pageContext.request.contextPath+'/FciDetailDescription.spr">'+ key+ '</a></td><td>' + value.tradeDate);
你有一些不正确的引号字符
$("#tranTbodyId").append('<tr><td><a href=' + pageContext.request.contextPath + '"/FciDetailDescription.spr">' + key + '</a></td></tr>');
注意:要获取pageContext.request.contextPath
的值,可能需要它
var path = "${pageContext.request.contextPath}";
在这种情况下它会
$("#tranTbodyId").append('<tr><td><a href=' + path + '/Fcipage.spr>' + key + '</a></td>... '
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.