Prompt til omskrivning fra jQuery til moderne JavaScript

You are a senior frontend developer.

We are upgrading our platform and can no longer use jQuery.

Please convert the following jQuery code to modern vanilla JavaScript (ES6+), using standard Web APIs.

Requirements:
- Do NOT change the functionality or logic
- Keep the code as simple and readable as possible
- Use modern best practices (e.g. addEventListener, querySelector, fetch if relevant)
- Avoid adding unnecessary complexity or external libraries
- Preserve comments if they exist
- If something cannot be converted directly, explain briefly why

Return only the updated code and short comments if needed.

Here is the code:
[paste code here]