- Click
- Bind an event handler to the "click" event, or trigger that event on an element. Example: Appends alternating colors creating a looped sequence.
- Hide
- Hide the matched elements. Example: Hiding this emojis one by one as you continue clicking.
- Show
- Display the matched elements. Example: Showing emoji one by one as you click.
- Toggle
- Display or hide the matched elements. Example: Square toggles from green to red simultaneously.
- Slide Down
- Display the matched elements with a sliding motion. Example: The image will show slide down.
- Slide Up
- Hide the matched elements with a sliding motion. Example: The image will display none slide up.
- Slide Toggle
- Display or hide the matched elements with a sliding motion. Example: The image will slide up and down when button was clicked.
- Fade In
- Display the matched elements by fading them to opaque. Example: This image will show fade in.
- Fade Out
- Hide the matched elements by fading them to transparent. Example: The image will fade out and display none.
- Add Class
- Adds the specified class(es) to each element in the set of matched elements. Example: We will add class ".addMargin" equivalent to 'margin-left:8.5rem' as we click the button.
- Before
- Insert content, specified by the parameter, before each element in the set of matched elements. Example: We will insert in-loved heart before it broken heart.
- After
- Insert content, specified by the parameter, after each element in the set of matched elements. Example: The image will insert after.
- Append
- Insert content, specified by the parameter, to the end of each element in the set of matched elements. Exampe: The word "happy" and emoji will append to "I am very:".
- Html
-
Get the HTML contents of the first element in the set of matched elements. Example: Add some
html to each div with class "greet".
Originally, it was : ; Now using this, $(".greet").html(" Nice to meet you Master "); - Attr
- Get the value of an attribute for the first element in the set of matched elements. Example: The placeholder attribute of the input will change to "Address".
- Val
- Get the current value of the first element in the set of matched elements. Example: The value of input will show to the output area, try to type value on input.
- Text
- Get the combined text contents of each element in the set of matched elements, including their descendants. Example: The text will change to "I am young" plus emoji.
🫣 😶🌫️ 🫥
😃 😎 😋
🟩 🟩 🟩
🟥 🟥 🟥
👻 👺 💀
🐸 🦊 🐷
<p class="addClass"></p>
🤶 🎅 🧑🎄
💔
🤢
I am very:
Hi 🙋♂️
<p><input
type="text" placeholder="Email Address"></p>
<p class="text">I am Old 👴</p>
I am Old 👴