變量的值,我如下傳遞的jQuery
$(document).ready(function() {
$("li").click(function() {
var str = $(this).index();
alert(str);
$("#headdiv div:nth-child(" + str + ")").addClass("product-active");
});
});
我想通過存儲在str變量爲n個子指數值寫在jQuery的代碼。我在哪裏做錯了?
.........'STR + 1' –