jQuery Exercises

Fill in the blanks to test your knowledge.

1

Select an element by its ID

("#myDiv")

2

Attach a click event handler

$("button").(function() {

alert("Clicked!");

});

3

Change the CSS color of an element

$("p").("color", "red");

4

Set the inner HTML of a div

$("#output").("<b>Hello</b>");

5

Make an AJAX GET request

$.({
url: "/api/data",
method: "GET"
});
6

Hide a selected element

$("#banner").()

7

Add a CSS class to an element

$("div").("active");

8

Get the value of an input field

const val = $("#email").()