Why jQuery.ready has strikethrough?

Viewed 2064

When I copy and paste my code into this question, the ready does not have strike-through, but in my IDE (VS), you'll see that it looks like ready.

Does this mean anything? The code still seems to work, but if it's an issue, I'd like to figure it out now; as I want to use jQuery in the right way.

My code:

$(document).ready(
    function () {
        $('.pets').hide();
    }
)

What I see in my VS:

What I see on my VS

1 Answers

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();
});
Related