jquery 目标对象在JavaScript数组中并添加类

ax6ht2ek  于 12个月前  发布在  jQuery
关注(0)|答案(1)|浏览(112)

目前我使用annotorious.js来获取文本注解。使用文档,我能够记录“x”数量的数组。
我试图从每个数组中访问每个“文本”对象,要么让它显示在文本框中,要么添加一个类,这样我就可以css样式了。
我的主要目标是让数组中的所有文本都立即显示在浏览器中。

const annotations = anno.getAnnotations();


console.log(annotations);

omjgkv6w

omjgkv6w1#

运行一个循环并将所有文本值压入“x”数组中。

const annotations = anno.getAnnotations();
var x = [];

for (var i = 0; i < annotations.length; i++) {
    x.push(annotations[i]["text"]);
}

console.log(x);

相关问题