https://github.com/milesbarr/enhancejs
A lightweight JavaScript library that provides progressive enhancements for HTML.
https://github.com/milesbarr/enhancejs
html html5 javascript javascript-vanilla js progressive-enhancement vanilla-javascript vanilla-js
Last synced: 9 months ago
JSON representation
A lightweight JavaScript library that provides progressive enhancements for HTML.
- Host: GitHub
- URL: https://github.com/milesbarr/enhancejs
- Owner: milesbarr
- License: mit
- Created: 2025-03-08T17:28:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-01T21:45:42.000Z (10 months ago)
- Last Synced: 2025-09-01T23:28:14.280Z (10 months ago)
- Topics: html, html5, javascript, javascript-vanilla, js, progressive-enhancement, vanilla-javascript, vanilla-js
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Enhance.js
A lightweight JavaScript library that provides progressive enhancements for HTML
forms and user interactions. This library adds functionality while maintaining
zero dependencies and graceful degradation.
## Setup
Include the library in your HTML file:
```html
```
For graceful degradation for users with JavaScript disabled, copy
[`noscript.html`](noscript.html) into the `` section of your HTML file.
## Usage
### Form Confirmations
Add confirmation dialogs to forms or form submission buttons:
```html
Submit
```
### Unsaved Changes Warning
Warn users about unsaved changes in forms:
```html
```
### Share Buttons
Add share functionality:
```html
Share
```
### Copy Buttons
Add copy-to-clipboard functionality:
```html
Copy
```
### Image File Previews
Preview images for file inputs:
```html
```
### Character Counter
Display the remaining character count for text inputs:
```html
```
### Auto-Resizable Textareas
Automatically adjust textarea height based on content:
```html
```
### Smooth Scrolling
Automatic smooth scrolling to anchor links:
```html
Go to section
Content
```
### Invalid Inputs
Automatically reset `aria-invalid` attributes:
```html
```
### File Drag-and-Drop
Add file drag-and-drop functionality:
```html
```
### AJAX Support
Use AJAX for form submissions and link navigation:
```html
```
## Graceful Degradation
All features are implemented as progressive enhancements, meaning the basic
functionality will work even if JavaScript is disabled.
## License
This project is licensed under the [MIT License](LICENSE).