😂Random Joke Generator with HTML, CSS & JavaScript
Looking for a fun and easy project to improve your JavaScript skills? In this tutorial, I’ll show you how to make a Random Joke Generator using only HTML, CSS, and JavaScript — no libraries or frameworks needed!
This is a perfect beginner-friendly project that will help you understand how to fetch data from an API, update the DOM, and make your web page interactive.
🎥 Watch Video Tutorial:
📺 Watch the full step-by-step video on YouTube:
👉 Click here to watch
💻 What You'll Learn in This Project:
HTML structure for the layout
CSS styling and simple UI design
JavaScript fetch()
API
DOM manipulation
Event listeners
Working with JSON data
⚙️ Tools & Technologies Used:
HTML
CSS
JavaScript
Public Joke API (optional)
Code Editor (like VS Code)
📦 Download Source Code:
HTML:
CSS:
JavaScript:
const jokeContainer = document.getElementById("joke");const btn = document.getElementById("btn");const url = "https://v2.jokeapi.dev/joke/Any?blacklistFlags=nsfw,religious,political,racist,sexist,explicit&type=single";
let getJoke = () => { jokeContainer.classList.remove("fade"); fetch(url) .then(data => data.json()) .then(item =>{ jokeContainer.textContent = `${item.joke}`; jokeContainer.classList.add("fade"); });}btn.addEventListener("click",getJoke);getJoke();
🧠 Why This Project is Great for Beginners?
Short & simple codeFun and interactive output
No need for frameworks
Teaches real-life use of APIs
Looks impressive in your portfolio!
🌐 Related Projects:
✅ Interactive panda Login Form using Javascript
✅ Bulb On/Off using HTML, CSS & JS
✅ Tic-Tac-Toe game with JavaScript
💬 Final Thoughts:
Projects like this are a fun way to learn and show off your skills. Once you're comfortable with this, try customizing the UI, adding dark mode, or using your own joke list. Don’t forget to subscribe to my YouTube channel for more creative web dev projects!
🔗 Stay Connected:
🎥 YouTube: Alizeh Codes
🌐 Blog: alizehcodes
📸 Instagram: @alizehcodes
💬 WhatsApp Channel: Join here
🏷️ Hashtags for Sharing:
#javascriptproject
#htmlcssjs
#randomjokegenerator
#webdevelopment
#funproject
#frontenddev
#learnjavascript
0 Comments