您好我尝试在"数组"中添加html标签我的代码,你能帮助我吗?
$(document).ready(function() {
var quotes = new Array("exemple exemple","exemple...");
var randno = Math.floor(Math.random()*(quotes.length));
$('.quote').append(quotes[randno]);
console.log(randno);
}
答案 0 :(得分:0)
简单地将您想要的标记写入数组(并使用'
作为标记中的引号)
....
var quotes = new Array("<li>bla</li>","<a href='http://www.google.com'>link</a>");
或
....
var quotes = new Array();
quotes.push("<li>asdf</li>");