操作jQuery

时间:2023-03-09 18:11:32
操作jQuery

====================================

$('img').each(function(){

  this.alt='This is image['+n+'] with an id of '+this.id;

});

var allAlts = new Array();

$('img').each(function(){

  allAlts.push(this.alt);

})

写一个动态获取div高度和宽度

function report(){

  $('#display').html(

    $('text').width()+'x'+$('text').height()

  )

}

<body onresize='report'>

闲着蛋疼可以试试哦  很好用的

————————————————————————

扩展JQ的写法来一发

$.fn.getClassNames =function () {

  if (name = this.arrt('className')) {

    return name.split(" ")

  }

  else{

    return [];

  }

}

————————————————————————

其他操作还有

最后再说点

  clone的东西最好不要true,然后用on绑定js这样操作会比较好,上次插入autocomplete就有问题 还是老实点解绑再绑定的写法

  一般的使用 内部插入  remove和add会使用 基本差不多了吧.... 目前也就这样 搜嘎