Edu
Hub
Courses
AI Tools
Leaderboard
Login/Register
AR
Abdullah Rashid
abdullah@example.com
Navigation
📚
Courses
🏆
Leaderboard
✨
AI Tools
←
jQuery Selectors Challenge
⏱
15:00
Quit
0 / 21 answered
0%
jQuery Selectors Challenge
10 questions · Medium difficulty · 00:21:00 min
🔥 In Progress
Question 1
Which jQuery selector targets all <p> elements?
$("p")
$"p"");
$("#p")
$(".p")
Question 2
How do you select an element with the ID "myElement" in jQuery?
$("myElement")
$("id=myElement")
$("#myElement")
$(".myElement")
Question 3
What does the jQuery selector $(".myClass") select?
All elements named 'myClass'.
All elements with the ID 'myClass'.
All elements with the class 'myClass'.
The first element with the class 'myClass'.
Question 4
Which of these selects the first <h2> element inside any element with the class "content"?
$("#content h2:nth-child(1)")
$(".content h2.first")
$(".content h2:first")
$(".content > h2")
Question 5
What is the purpose of the * (wildcard) selector in jQuery?
Selects all elements in the document.
Selects all descendant elements.
Selects all elements with a specific attribute.
Selects all elements except the body.
Question 6
Which selector targets all <a> elements that have an "href" attribute?
$("a[href]")
$("a.href")
$("a:has(href)")
$("a[href!=null]")
Question 7
How do you select the parent of a specific element with the ID "childElement"?
$("#childElement").parent()
$("#childElement").ancestor()
$(".parentOf #childElement")
$("#childElement").parents()
Question 8
Which selector selects all <input> elements of type "text"?
$("text")
$(":input-text")
$("input[type='text']")
$("input.text")
Question 9
What does the :first-child pseudo-class selector do?
Selects any element that is the first child of its parent.
Selects the last element among its siblings.
Selects the first element matching a tag name.
Selects the first element in the entire document.
Question 10
Which selector returns all elements that are direct children of an element with ID "container"?
$("#container > *")
$("#container:children")
$("#container *")
$("container > *")
Question 11
How do you select all <option> elements that are selected?
$("option[selected]")
$(":selected")
$("option.selected")
$("option:checked")
Question 12
What is the difference between $("#myId") and $("div#myId")?
$("#myId") selects a div element with ID 'myId', while $("div#myId") selects any element with that ID.
They are identical and select the element with ID 'myId'.
$("#myId") selects all elements with ID 'myId', while $("div#myId") selects only div elements with that ID.
There is no difference in modern jQuery versions.
Question 13
Which selector targets all elements with the attribute "data-custom" set to the value "important"?
$(".data-custom.important")
$("[data-custom='important']")
$("[data-custom] == 'important'")
$("data-custom=important")
Question 14
How do you select all elements that are *not* of type <p>?
$("![p]")
$(":not(p)")
$("other")
$("*:not-p")
Question 15
What does the :last selector do?
Selects the last element in the entire document.
Selects the last element among its siblings.
Selects the last element in a set of matched elements.
Selects the first element in a set of matched elements.
Question 16
Which selector targets all elements with the class "item" that also have the attribute "disabled"?
$(".item :disabled")
$(".item disabled")
$("[class=item][disabled]")
$(".item[disabled]")
Question 17
How do you select the next sibling element of an element with the ID "current"?
$("#current.next")
$("#current + *")
$("#current").next()
$("#current").nextSibling
Question 18
What does the :even selector do?
Selects all even numbered elements in the DOM.
Selects elements that have an even number of children.
Selects elements with an odd index (1, 3, 5...).
Selects elements with an even index (0, 2, 4...).
Question 19
Which selector targets all <div> elements that are direct children of an element with the class "wrapper"?
$("div.wrapper")
$(".wrapper > div")
$(".wrapper:children(div)")
$(".wrapper div")
Question 20
How do you select all form elements whose name attribute starts with "user"?
$("form[name*='user']")
$("form[name='user']")
$("form[name~$='user']")
$("form[name^='user']")
Question 21
What does the $(document).ready() function ensure?
The DOM (Document Object Model) is fully loaded and ready to be manipulated.
jQuery has been successfully included in the page.
The page has finished loading entirely, including images and other assets.
A specific element with the ID 'ready' exists.
✅ Answered:
0
⬜ Unanswered:
8
📊
20%
done
Submit Answers →