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")
$("#myElement")
$("id=myElement")
$(".myElement")
Question 3
What does the jQuery selector $(".myClass") select?
The first element with the class 'myClass'.
All elements with the class 'myClass'.
All elements with the ID 'myClass'.
All elements named '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")
$(".content h2:first")
$(".content h2.first")
Question 5
What is the purpose of the * (wildcard) selector in jQuery?
Selects all elements except the body.
Selects all elements with a specific attribute.
Selects all descendant elements.
Selects all elements in the document.
Question 6
Which selector targets all <a> elements that have an "href" attribute?
$("a:has(href)")
$("a[href!=null]")
$("a.href")
$("a[href]")
Question 7
How do you select the parent of a specific element with the ID "childElement"?
$("#childElement").parent()
$("#childElement").parents()
$(".parentOf #childElement")
$("#childElement").ancestor()
Question 8
Which selector selects all <input> elements of type "text"?
$("input[type='text']")
$("input.text")
$("text")
$(":input-text")
Question 9
What does the :first-child pseudo-class selector do?
Selects the first element in the entire document.
Selects the first element matching a tag name.
Selects the last element among its siblings.
Selects any element that is the first child of its parent.
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?
$(":selected")
$("option[selected]")
$("option.selected")
$("option:checked")
Question 12
What is the difference between $("#myId") and $("div#myId")?
They are identical and select the element with ID 'myId'.
There is no difference in modern jQuery versions.
$("#myId") selects all elements with ID 'myId', while $("div#myId") selects only div elements with that ID.
$("#myId") selects a div element with ID 'myId', while $("div#myId") selects any element with that ID.
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>?
$(":not(p)")
$("![p]")
$("other")
$("*:not-p")
Question 15
What does the :last selector do?
Selects the last element in the entire document.
Selects the last element in a set of matched elements.
Selects the last element among its siblings.
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"?
$("[class=item][disabled]")
$(".item :disabled")
$(".item[disabled]")
$(".item disabled")
Question 17
How do you select the next sibling element of an element with the ID "current"?
$("#current.next")
$("#current").next()
$("#current + *")
$("#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 even index (0, 2, 4...).
Selects elements with an odd index (1, 3, 5...).
Question 19
Which selector targets all <div> elements that are direct children of an element with the class "wrapper"?
$(".wrapper > div")
$("div.wrapper")
$(".wrapper div")
$(".wrapper:children(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.
A specific element with the ID 'ready' exists.
The page has finished loading entirely, including images and other assets.
✅ Answered:
0
⬜ Unanswered:
8
📊
20%
done
Submit Answers →