您好,欢迎访问一九零五行业门户网

js multiple全选与取消全选实现代码_javascript技巧

复制代码 代码如下:
$(select).change(function(){
    var n = $(this).children().length;
    var obj;
    var i = 1;
       $(this).children().each(function(){
     if(i == n)
     {
      alert($(this).text());
     }
     i++;
    });
   });
综合以上二法,本人轻易得出了自己想要的效果,如下:
复制代码 代码如下:
function selectall()
{
 $(select).children().each(function(){$(this).attr(selected,selected)})
}
分别用到了 children()和$(this).attr(selected,selected)
一个js用法
复制代码 代码如下:
(003) 娑
其它类似信息

推荐信息