在javascript文件中编写html标签而不是“text”

Writing html tag instead of "text" in javascript file

本文关键字:text 标签 html 文件 javascript      更新时间:2023-09-26

我正在使用生成滑块的 bxslider 轮播,作为我拥有的设置的一部分:

    ...
    nextText:"Next",
    prevText:"Prev",
    ...

因此,滑块中的下一个按钮具有文本"下一步"(上一个按钮也是如此)。但是我想添加一个带有图像的跨度,而不是文本。如何更改它,使其显示类似<span class="glyphicon glyphicon-search"></span>而不是"下一个"或"上一个"文本?

提前致谢

网站链接

我已经通过这个链接解决了这个问题。我很抱歉这个弱小的问题。我这样补充了;

nextText: '<span class="glyphicon glyphicon-search"></span>'

如果要将标记添加到现有 HTML 标记,例如 id 为 myDiv 的div:

getElementById('myDiv').innerHTML = '<span class="glyphicon glyphicon-search"></span>';

getElementById('myDiv').appendChild('<span class="glyphicon glyphicon-search"></span>');