Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Implementing Filtering Functionality | Building the Blog Website
AI Powered Web Development Essentials

bookImplementing Filtering Functionality

Goal

Last but not least, the final step is to add functionality for filtering the articles by topic, which will be implemented using JavaScript.

Possible Prompt

Can you implement the feature of filtering articles by topic using HTML buttons and JavaScript?

Result

index.html file

  • We add a nav block to the header where our filtering buttons will be placed;
  • We provide each article with the data-category attribute and the corresponding topic value;
  • We add the link to the index.js file before the closing body tag.

index.css file
We add some styles to make the filtering buttons look pretty.

index.js file
We paste the script that implements the filtering logic.

All this ChaGPT told us to do. We followed its instructions.

index.html

index.html

index.css

index.css

index.js

index.js

copy

Website State

Video Tutorial

Here you go. You did it. This is your complete, fully functional website. Great job!

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 6

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Awesome!

Completion rate improved to 5

bookImplementing Filtering Functionality

Scorri per mostrare il menu

Goal

Last but not least, the final step is to add functionality for filtering the articles by topic, which will be implemented using JavaScript.

Possible Prompt

Can you implement the feature of filtering articles by topic using HTML buttons and JavaScript?

Result

index.html file

  • We add a nav block to the header where our filtering buttons will be placed;
  • We provide each article with the data-category attribute and the corresponding topic value;
  • We add the link to the index.js file before the closing body tag.

index.css file
We add some styles to make the filtering buttons look pretty.

index.js file
We paste the script that implements the filtering logic.

All this ChaGPT told us to do. We followed its instructions.

index.html

index.html

index.css

index.css

index.js

index.js

copy

Website State

Video Tutorial

Here you go. You did it. This is your complete, fully functional website. Great job!

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 6
some-alt