8. jQuery Flashcards
What is jQuery?
A fast, small, and feature-rich JavaScript library designed to simplify the scripting of HTML
What is jQuery structure?
$(selector).action();
What is $?
A shorthand for jQuery.
Reading HTML
$(“#myDiv”).html();
Writing /updating HTML content of the selected element
$(“#myDiv”).html(“<p>New HTML Content</p>”);
What is .html() method used for?
Used to get or set the HTML content of an element
What is .val() method used for?
Used to get or set the value of form elements, such as input, textarea, or select elements
What is .append() method used for?
Used to insert content at the end of the selected element(s). It allows you to dynamically add new HTML elements without replacing existing content
What is an event?
An event is a condition that your code is waiting for
How to program a clickable button?
$(“#btn_1”).click(function(){
console.log(“button click!”);
});
Click method syntax
$().click();
What is anonymous function?
Function with no name?