by agate - Published: 2009-07-16 [5:29 下午] - Category: 日志, 程序编码

天煞的 first 阿, 今天我找一个 bug 半天不得其解. firebug 竟然告诉我 jquery 对象没有 first 这个方法...(请别笑我, 我一直以为有这个方法的.)

教我的一个同事告诉我这个方法. 甚至他给我的一个文档中也有这个方法. 我的天阿, 没想到这个方法竟然是公司加的一个 helper 方法. 我甚至把他用在了我好多 demo code 中. 可怕阿!

这件事教育我 alias 好用. 但是别不懂所以然就去使用.

Tags: [ , ] - Comments: View Comments
  • prototype 有 first 方法,一般都是用在 selector 的结果中:
    $$('.item').first()
  • 谢谢分享!
    主要是通过这件事情才知道, 还是得好好地仔仔细细地学习官方的 document, 在写点 helloworld 之类的就好避免这类问题了
blog comments powered by Disqus