DEV Community

Cover image for How I Made a Web Form That Suggests Skills Using AI + JavaScript
nexgismo
nexgismo

Posted on

How I Made a Web Form That Suggests Skills Using AI + JavaScript

Modern users expect more than just input fields—they expect guidance, personalization, and efficiency. So I decided to explore how we could use AI to make web forms smarter, specifically by suggesting relevant skills based on user input.

In this post, I’ll walk through how we added a lightweight AI layer on top of a typical HTML/JS form, using a language model to dynamically suggest skills as a user types their job title or description.


🔍 The Idea

What if your form could suggest skills like this:

  • User enters: Frontend Developer
  • Suggested Skills: JavaScript, React, CSS, Responsive Design

We made this work by:

  • Capturing input events in JS
  • Sending them to an API powered by a language model
  • Injecting suggested skills back into the DOM

⚙️ How It Works (High-Level)

  1. Input Monitoring
document.querySelector('#job-title').addEventListener('input', (e) => {
  fetchSuggestions(e.target.value);
});
Enter fullscreen mode Exit fullscreen mode

Call to AI Model (LLM API)

async function fetchSuggestions(input) {
  const res = await fetch('/suggest-skills?title=' + input);
  const skills = await res.json();
  updateUI(skills);
}
Enter fullscreen mode Exit fullscreen mode

Update the Form

function updateUI(skills) {
  const list = document.querySelector('#suggested-skills');
  list.innerHTML = skills.map(s => `<li>${s}</li>`).join('');
}
Enter fullscreen mode Exit fullscreen mode

Why This Matters

This isn't just a cool trick — it's an example of practical AI UX. Forms can now guide users rather than passively collect data.

  • Improves form completion
  • Reduces errors
  • Feels more intelligent and helpful

📖 Full Walkthrough

I've shared a full technical breakdown and examples in this blog post:

👉 Read the Full Post Here

Top comments (0)