我想将数据从一个标签传输到另一个标签。
这是我得到的结果:
<a id="oldartist"> {{ object.user }}</a>
<a id="newartist"></a>
function newArt() {
var artistname = document.getElementById("oldartist");
$('#newartist').text(artistname);
};
但是我明白了
https:// mywebsite.com/johndoe
代替
johndoe
为什么会发生这种情况,我该如何解决?
谢谢你的帮助
最佳答案
您正在添加 <a>
标签中的元素,它需要,
function newArt() {
var artistname = document.getElementById("oldartist").text;
$('#newartist').text(artistname);
};
关于javascript - Django 和 JQuery - 查找和替换文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58466969/