Edu
Hub
Courses
AI Tools
Leaderboard
Login/Register
AR
Abdullah Rashid
abdullah@example.com
Navigation
📚
Courses
🏆
Leaderboard
✨
AI Tools
←
JQuery Basics Quiz
⏱
15:00
Quit
0 / 21 answered
0%
JQuery Basics Quiz
10 questions · Medium difficulty · 00:21:00 min
🔥 In Progress
Question 1
Which of the following is the correct way to select an element with the ID 'myElement' using JQuery?
$('myElement')
$('.myElement')
JQuery('#myElement')
$('#myElement')
Question 2
What does the JQuery `$(document).ready()` function do?
It loads external JQuery files.
It executes code when the DOM is fully loaded and ready.
It executes code when the page has completely finished loading, including all assets like images and stylesheets.
It executes code only when the user clicks a button.
Question 3
Which JQuery method is used to get the text content of the first matched element?
.text()
.content()
.html()
.val()
Question 4
How do you add a CSS class named 'active' to an element with the ID 'myButton' using JQuery?
$('#myButton').set('class', 'active')
$('#myButton').add('active')
$('#myButton').css('class', 'active')
$('#myButton').addClass('active')
Question 5
What is the JQuery selector for selecting all `p` elements?
$('element:p')
$('.p')
$('#p')
$('p')
Question 6
Which JQuery method is used to append content to the end of each selected element?
.append()
.after()
.prepend()
.before()
Question 7
What does the JQuery `hide()` method do?
It hides the element only from mobile devices.
It removes the element completely from the DOM.
It makes the element transparent.
It changes the display property of the element to 'none'.
Question 8
Which selector is used to select elements with a specific attribute, like `[href]`?
$('[href]')
$('element[href]')
$('attribute=href')
$('has_attribute(href)')
Question 9
How do you get the value of an input field with the ID 'myInput'?
$('#myInput').val()
$('#myInput').attr('value')
$('#myInput').innerHTML
$('#myInput').text()
Question 10
What is the JQuery method used to attach an event handler for a 'click' event?
.bind('click', function(){...})
.addEvent('click', function(){...})
.click(function(){...})
.on('click', function(){...})
Question 11
Which JQuery method is used to remove an element from the DOM and all its child elements?
.remove()
.empty()
.hide()
.detach()
Question 12
What does the JQuery `css()` method do when passed a single property name and value?
It toggles the CSS property.
It retrieves the value of that CSS property.
It removes the CSS property.
It sets the value of that CSS property for the selected element(s).
Question 13
How can you select all elements that are direct children of another element using JQuery?
$('parent child')
$('parent > child')
$('parent + child')
$('parent.child')
Question 14
What is the purpose of the JQuery `attr()` method?
To get or set the text content of an element.
To get or set the CSS properties of an element.
To get or set the value of an HTML attribute.
To add or remove HTML elements.
Question 15
Which JQuery method is used to find the closest ancestor of the current element that matches a selector?
.find()
.parent()
.closest()
.parents()
Question 16
What does `$(this)` refer to inside a JQuery event handler function?
The element that triggered the event.
The JQuery object itself.
The global `window` object.
The parent element of the triggered element.
Question 17
Which JQuery method is used to insert content immediately before the selected element(s)?
.append()
.before()
.appendTo()
.insertAfter()
Question 18
What does the JQuery `toggle()` method do?
It toggles the visibility of an element (show/hide).
It toggles between two CSS styles.
It toggles a class on an element.
It toggles the content of an element.
Question 19
How do you select all elements with the class 'item' that are also `div` elements?
$('div .item')
$('div.item')
$('item, div')
$('.item div')
Question 20
What is the JQuery method for finding descendant elements of the selected element?
.children()
.parent()
.find()
.closest()
Question 21
How do you empty the content of an element with the ID 'myDiv'?
$('#myDiv').empty()
$('#myDiv').clear()
$('#myDiv').delete()
$('#myDiv').remove()
✅ Answered:
0
⬜ Unanswered:
8
📊
20%
done
Submit Answers →