"Learning JQuery" issues

Even reading closely the instructions I don’t get to create a script element.
here are the instructions.
Create a script element making sure it is valid and has a closing tag.
You should add $(document).ready(function() { to the beginning of your script element.
Close your $(document).ready(function() { function with });`

script is an HTML element (just like p or body). In order to be valid HTML, it must have a closing tag (unlike single-tag elements such as img).

Everything inside your script tags will be interpreted as JavaScript (jQuery is a JavaScript library).

$(document).ready(function() {

});

…is jQuery code that creates a JavaScript function. Code contained within it will be executed when the document (i.e. the webpage) is ready. Note that for this exercise, you’re not required to actually write any code to be executed other than setting up that function.

1 Like

Just to add that you can use shorthand for $(document).ready() and that is just the function itself with an addition of $ in front. That function will be executed when whole page is loaded. Basically everything that is inside $ and brackets refers to the jQuery.

$(function() {
// javascript code that runs when page is fully loaded
});

1 Like