0
我有一个动态生成列表。jquery切换动态列表三态
当我点击一行我想切换背景颜色让我们说,红绿黄。例如,当id不动态时,我已经看到了答案。
<ul data-role="listview" id="my-listview" >
<c:forEach var="line" items="${tl.reqs}">
<li id="lnk"><a href="#" onclick= '
$(this).toggle(function(){
$(this).css("background-color","green");},
function(){
$(this).css("background-color","red");},
function(){
$(this).css("background-color","yellow");}
);'
${line.name}</a>
</li>
</c:forEach>