fork-commit-merge / fork-commit-merge

Fork, Commit, Merge. A project designed to help you familiarize yourself with the open source contribution workflow on GitHub!

Home Page:https://forkcommitmerge.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fork, Commit, Merge - Easy Issue (HTMX)

nikohoffren opened this issue · comments

Fork, Commit, Merge - Easy Issue (HTMX)

Add Simple HTMX Button

Note: You don't have ask permission to start solving the issue or get assigned, since these issues are supposed to be always open for new contributors. The actions-user bot will reset the file back to previous state for the next contributor after your commit is merged. So you can just simply start working with the issue right away!

How to get started

Open the tasks/htmx/easy directory from the root of your project.
Then open the index.html file and start implementing your solution!

Description

Your task is to add an HTMX button element to the HTML file.
The button should meet the following requirements:

  • The button should have an hx-get attribute that points to a URL of your choice (you can use a placeholder URL like "/your-endpoint").
  • The button should have an hx-trigger attribute set to "click".
  • When the button is clicked, it should load content from the URL specified in the hx-get attribute into an element on the page.
  • Create a target element with a unique ID (e.g., hx-target="#result") below the button and ensure that the button's hx-target attribute corresponds to the ID of the target element.

Once you've added the button with the correct HTMX attributes, you should be able to click it, and it should load content into the specified target element. You can test your implementation by opening the HTML file in a web browser.

At this stage, please be aware that the button's functionality has been implemented without the need for server-side operations.
Purpose of this task is just to use the HTMX attributes.

How to run

If you are using VS Code and have for example Live Server extension, you can simply open index.html with the server and check if it works correctly. If it does, you are ready to make a pull request!
If you do not have Live Server extension, you'll find information about installing and how to use it here.


Check out README.md for more instructions and how to make a pull request.

Feel free to ask any questions here if you have some problems!

Also, kindly give this project a star to enhance its visibility for new developers!