码迷,mamicode.com
首页 > Web开发 > 详细

操作jQuery

时间:2016-09-09 11:37:47      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:

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

$(‘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会使用 基本差不多了吧.... 目前也就这样 搜嘎

 

操作jQuery

标签:

原文地址:http://www.cnblogs.com/wulibo/p/5855754.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!