javascript:how to write $(document).ready like event without jquery
问题 in jquery $(document).ready(function) or $(function) , how could I do the same thing without jquery, and I need browser compatiable, and allow to attach more than one function. Note: dom ready!= window onload 回答1: This is the way jQuery wraps the functions you're looking for - the snippet does not need jQuery, and is cross-browser compatible. I've replaced all calls to jQuery.ready() with yourcallback - which you need to define. What goes on in here: first, the function DOMContentLoaded is