The jQuery documentation says:
jQuery offers several ways to attach a function that will run when the
DOM is ready. All of the following syntaxes are equivalent:
$( handler )
$( document ).ready( handler )
$( "document" ).ready( handler )
$( "img" ).ready( handler )
$().ready( handler )
As of jQuery 3.0, only the first syntax is recommended; the other
syntaxes still work but are deprecated.
So change your code to:
$(function () {
$('.pets').hide();
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…