現在一個頁面有2個部分的上下無效圖標判斷,這里的意思是要把它封裝一下。全部把class定義上item-up,item-down??墒菂s發現,這個只有第一個最上面的圖標無效,和第二個最下面的圖標無效。無法做到分別在各自的那一塊無效。只有class不一樣才能分別最上面和最下面無效?,F在想在html的class上統一定義就是,item-up,item-down。但是不知道jquery這邊怎么寫怎么判斷啊,如果以后頁面是三塊,四塊呢?總之在class類名不變的情況下,想封裝。
現在的html視圖如下
1圖標上<button type="button" class="btn btn-primary btn-xs angle-up item-up-1"><i class="fa fa-angle-up" aria-hidden="true"></i></button>
1圖標下<button type="button" class="btn btn-primary btn-xs angle-down item-down-1"><i class="fa fa-angle-down" aria-hidden="true"></i></button>
2圖標上<button type="button" class="btn btn-primary btn-xs angle-up item-up-2"><i class="fa fa-angle-up" aria-hidden="true"></i></button>
2圖標下<button type="button" class="btn btn-primary btn-xs angle-down item-down-2"><i class="fa fa-angle-down" aria-hidden="true"></i></button>
想把class全部統一成
class="btn btn-primary btn-xs angle-up item-up"
class="btn btn-primary btn-xs angle-up item-down"
現在的jq如下 不知道怎么寫
$(document).ready(function(){
$(".item-up").eq(0).prop("disabled", true);
$(".item-down").eq(-1).prop("disabled", true);
});
- 1 回答
- 0 關注
- 460 瀏覽
添加回答
舉報
0/150
提交
取消