-
Scaffold a new vite vanilla project
pnpm init vite@latest .
command -
Install tailwindcss
pnpm add -D tailwindcss postcss autoprefixer
-
create setting files using:
pnpx tailwindcss init -p
-
In your css file add the tailwind directives:
@tailwind base;
@tailwind components;
@tailwind utilities;
- Install daisyui
pnpm add -D daisyui
- Add this in your tailwind.config.js file
module.exports = {
content: ["./index.html", "./src/**/*.{js}"],
theme: {
extend: {},
},
plugins: [require("daisyui")],
};
Bubbling
: Event target element se upar parent elements tak propagate hota hai.
Capturing
: Event root se start ho kar target element tak reach karta hai.
Delegation
: Parent element pe ek listener laga ke, child element ke events handle karte ho using bubbling.
stopPropagation()
: event ko bubble ya capture hone se rokta hai.
// Child element pe event listener
document.getElementById("child").addEventListener("click", function (event) {
console.log("Child clicked");
event.stopPropagation(); // Event propagation stop
});