我正在使用以下函数打印出javascript变量的内容。如何使用jQuery正确打印HTML中的变量
function message(){
$("#description").html("Candidate " + (lowest+1) + " was the first to get eliminated ending on " + results[lowest][0]+ "%");
}
这正确正常工作,但是如果我试试这个:
function message(){
$("#description").html("Candidate " + (lowest+1) + " was the first to get eliminated ending on " + results[lowest][0]+ "%");
$("#description").html("Candidate " + (lowest2+1) + " was the second to get eliminated ending on " + results[lowest2][0]+ "%");
}
这显然是行不通的。第二条消息覆盖第一条消息的文本。什么是正确的方式显示这两个消息。