$(document).ready() or $(function()) — Which to use?

后端 未结 4 537
后悔当初
后悔当初 2021-01-17 07:59

I saw there is an answered question about whether there is a difference between using $(document).ready(function(){}) and $(function(){}) (there is

4条回答
  •  失恋的感觉
    2021-01-17 08:48

    I find that $(function() {}); is just simpler and saves a few characters. Like you said, it doesn't matter. I think the more important things to worry about are your design patterns for your javascript. They can impact performance, readability, and simplicity.

提交回复
热议问题