我有一塊jQuery,當我重新加載/刷新頁面時,它改變了一個名爲#myQuote的div中的文本。我也想在旁邊有一個鏈接,你可以按下來刷新文本。我已經調用了我想要的link id =「requote」,所以當它被點擊時,它會改變類似於頁面刷新時的文本。點擊jQuery refesh
這裏是jQuery的我到目前爲止:
var myQuotes = new Array();
myQuotes[0] = "Quote One";
myQuotes[1] = "Quote Two";
myQuotes[2] = "Quote Three";
myQuotes[3] = "Quote Four";
var myRandom = Math.floor(Math.random()*myQuotes.length);
$('#myQuote').html(myQuotes[myRandom]);
謝謝:)
嘗試',而不是'.text' .html' – GroundZero