Websites, apps & code / Coding & debugging

Add a working button to a webpage

Your page needs something that reacts when clicked, like a price calculator or a hidden section.

1Fill in your details

Leave blank to use the example. Names are remembered for other prompts too (stored only on your device).

2Pick a variationHow your page is built

3Copy the prompt

I have a webpage and want a button that reacts when clicked. Please use plain JavaScript with no extra libraries.

What the page is now: A tuition centre page listing three courses with a price next to each
What the button should do: On "Calculate", show the total fee by number of students, 10% off for 3 or more
How the page is built: Give a script I can paste straight into the HTML and say exactly where.

Please:
1. Restate what you understood and ask about anything unclear first, such as how the discount rounds to the nearest sen.
2. Give the full HTML, CSS and JavaScript, with a large button that is easy to tap on a phone.
3. When the input is blank or not a number, show a friendly message instead of breaking.
4. Show me how to test it on my own computer.
5. Add a one-line plain Chinese comment above each block of code.
Use the prices I gave and do not change them.

[Make it sound human]
- Explain in plain words; no pleasantry openers or empty summaries.
- Only necessary, short, practical code comments; the simplest working approach, no over-engineering.
- Interface text (buttons, hints, error messages) should sound like a person wrote it; no "seamless", "empower", "unlock".
[Quality] Code must run as is and handle common errors; tell me how to test it and confirm it works; ask first if a requirement is unclear; never put passwords or API keys in the code.

Paste it into ChatGPT, Gemini, Claude or Meta AI.

Test result

This one was not tested on its own. Uses in this category share the same structure, and we spot-tested several of them, for example: Explain what code does, Fix an error message

AI tools that suit this

  • Claude Suggested tool Free plan

    Strong at long documents, editing and code

  • ChatGPT Suggested tool Free plan

    The most widely used AI chat, for writing, questions and images

  • Cursor Suggested tool Free plan

    AI code editor

Recommendations only, not sponsored. Check each site for what the free plan includes.

This site is made by FullMark Tech

Want your own website, or your shop spreadsheets automated? FullMark Tech builds business websites and custom Excel tools.

Ask on WhatsApp See FullMark Tech services