随笔分类 -  JavaScript

摘要:摘自:How do I remove a particular element from an array in JavaScript? 首先需要找到元素的下标: 使用splice函数进行移除: splice函数的第二个参数指删除的数目。splice直接修改原数组,并把删除的所有元素以另一个新数组的 阅读全文
posted @ 2017-08-20 14:48 raindream 阅读(236170) 评论(2) 推荐(3)
摘要:查找方法: 或者: 遍历: 如果checkbox的直接父亲不是checkArray,那么上述方法不起所用,可以用find: 或者: radio: 查看checked方法: 阅读全文
posted @ 2017-08-20 14:47 raindream 阅读(227) 评论(0) 推荐(0)
摘要:转自:jQuery empty() vs remove() empty() will remove all the contents of the selection. remove() will remove the selection and its contents. 阅读全文
posted @ 2017-08-20 14:46 raindream 阅读(460) 评论(0) 推荐(0)
摘要:两者基本相同,唯一不同点在于初始化: 也就是说Array(arg),其中的arg是指生成数组的长度。 参考:What’s the difference between “Array()” and “[]” while declaring a JavaScript array? 检查array是否为空 阅读全文
posted @ 2017-08-20 14:45 raindream 阅读(49320) 评论(0) 推荐(1)
摘要:1.执行时间 window.onload必须等到页面内包括图片的所有元素加载完毕后才能执行。 $(document).ready()是DOM结构绘制完毕后就执行,不必等到加载完毕。 2.编写个数不同 window.onload不能同时编写多个,如果有多个window.onload方法,只会执行一个  阅读全文
posted @ 2017-01-15 22:08 raindream 阅读(171) 评论(0) 推荐(0)
摘要:三种方法: 阅读全文
posted @ 2016-08-31 00:23 raindream 阅读(1706) 评论(0) 推荐(0)
摘要:Jquery UI tooltip on disabled button In general, disabled elements do not trigger any DOM events. Therefore, it is not possible to properly control to 阅读全文
posted @ 2016-08-31 00:23 raindream 阅读(138) 评论(0) 推荐(0)