1
2
3
4
5
6
7
8
9
10
|
<ul data-role=
"listview"
data-inset=
"true"
class=
"tjlist"
id=
"listorder"
>
<li>数量<span class=
"ui-li-aside"
>
<div data-role=
"controlgroup"
data-type=
"horizontal"
id=
"jiajian"
>
<a href=
"javascript:void(0)"
data-role=
"button"
data-theme=
"a"
onclick=
"chg(this,0)"
style=
"width:40px;"
>-</a>
<a href=
"javascript:void(0)"
data-role=
"button"
style=
"width:40px;"
id=
"selnum"
>1</a>
<a href=
"javascript:void(0)"
data-role=
"button"
data-theme=
"f"
onclick=
"chg(this,1)"
style=
"width:40px;"
>+</a>
</div>
</span></li>
<li>合计<span class=
"ui-li-aside"
>2400元</span></li>
</ul>
|
现在需要在函数chg()z中修改,对于的a标签的值。
比如:修改第一个a标签的data-theme为"f",修改第二个标签的html值为2.,修改第三个a标签的disabled为disabled。
1
2
3
|
$(
".ui-li-aside"
).eq(0).find(
"a"
).eq(0).attr(
"data-theme"
,
"f"
);
$(
".ui-li-aside"
).eq(0).find(
"a"
).eq(1).text(
"2"
);
$(
".ui-li-aside"
).eq(0).find(
"a"
).eq(2).attr(
"disabled"
,
"disabled"
);
|
来自本站论坛,作者ZHHAA发的帖子,a756375788作答。此处作为收藏。
下面是自己问题处理。
HTML部分:
<div data-role="collapsible-set" data-inset="false" id="bhlist"> </div>
动态添加部分请看图片。
js部分:
动态添加
var option = $("#bhlist").html();
for (var i = 0; i < d.length; i++) {
var options = '<div data-role="collapsible" id="bt' + i + '"><h3 οnclick="loadbz(' + i + ',' + d[i].TypeID + ',\'' + d[i].Name + '\')" id="bx' + i + '">' + d[i].Name + '</h3></div>';
option = option + options;
}
$("#bhlist").html(option);
$("#bhlist").collapsibleset('refresh', true);
折叠部分渲染
$("#bx" + j).find("a").css("color", "blue");
//$("#bx" + j).find("a").css("backgrounCcolor", "blue");//太丑了
$("#bhlist").trigger("create");
if ($("#pdbz").children().length > 1) {
$("#pdbz").empty();
}
//清除同级元素的改变
if ($("#bt" + j).prevAll().length > 0) {
$("#bt" + j).prevAll().find("h3").find("a").css("color", "black");
}
if ($("#bt" + j).nextAll().length > 0) {
$("#bt" + j).nextAll().find("h3").find("a").css("color", "black");
}