An open API service indexing awesome lists of open source software.

https://github.com/milesbarr/html-enhancer

A lightweight JavaScript library that provides progressive enhancements for HTML.
https://github.com/milesbarr/html-enhancer

html html5 javascript javascript-vanilla progressive-enhancement vanilla-javascript

Last synced: about 1 year ago
JSON representation

A lightweight JavaScript library that provides progressive enhancements for HTML.

Awesome Lists containing this project

README

          

# HTML Enhancer

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 required files:

```html

```

## Usage

### Form Confirmations

Add confirmation dialogs to form submissions using the `data-confirm` or
`data-formconfirm` attributes.

```html


```

```html

```

### Unsaved Changes Warning

Warn users about unsaved form changes with the `data-warn-unsaved` attribute.

```html

```

### Share Buttons

Add share buttons with the `data-share` attribute.

```html
Share
```

### Copy Buttons

Add copy buttons with the `data-copy` attribute.

```html

Copy
```

### File Upload Previews

Preview images for file inputs using the `data-preview-for` attribute.

```html


```

### Character Counter

Show the remaining character count for controls with the
`data-chars-remaining-for` attribute.

```html


```

### Invalid Inputs

Automatically set the `aria-invalid` attribute to `false` when an input changes.

```html

```

### AJAX

Allow for form submissions and link navigation with AJAX using
`data-ajax-replace`

```html


Refresh page

```

## 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).