读书人

自个儿实现Table增加Row时的几个心得记

发布时间: 2012-10-24 14:15:58 作者: rapoo

自己实现Table增加Row时的几个心得记录

?

自己用jQuery搞了个Table增加Row的东东,实现过程,有如下几个心得,记录在这里。

?

i.jQuery(table).append(jQuery(newRow)); jQuery API append方式的调用,通过这个append来给已有的Table新加行。

ii.var newRow = jQuery(hiddenRowEle).clone(true);这个clone方法是怎么封装document.getElementById(elemetId).cloneNode(true)的?jQuery做了这样的封装后弥补了cloneNode方法的哪些不足?

iii.jQuery的get(0)方法返回的是native的DOM元素?还是经过jQuery封装的?看jQuery的API,知道This(get(index)方法) allows you to extract the actual DOM element and operate on it directly without necessarily using jQuery functionality on it.

iv.直接调用jQuery(parentRow).remove();,而非native的remove,依稀记得native的remove方法在遍历地remove时,会在类似ArrayList中remove(Object o)时的问题。




读书人网 >Web前端

热点推荐