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

https://github.com/anduin2017/jquery-disable-with

Library to enable auto-disable options when submitting a form.
https://github.com/anduin2017/jquery-disable-with

Last synced: 8 months ago
JSON representation

Library to enable auto-disable options when submitting a form.

Awesome Lists containing this project

README

          

# jquery-disable-with

[![npm](https://img.shields.io/npm/v/jquery-disable-with.svg?style=flat)](https://www.npmjs.com/package/jquery-disable-with)
[![ManHours](https://manhours.aiursoft.cn/r/gitlab.aiursoft.cn/anduin/jquery-disable-with.svg)](https://gitlab.aiursoft.cn/anduin/jquery-disable-with/-/commits/master?ref_type=heads)

Add-on to jQuery to enable auto-disable options when submitting a form in data-disable-with attributes.

See a demo [here](https://developer.aiursoft.com/Samples/DisableWithForm)

## How to install

```bash
npm install --save jquery-disable-with
```

And check your reference. jQuery is required!

```html

```

Or using es6:

```javascript
import DisableWith from 'jquery-disable-with';
```

## How to use

Create a form

```html



```

Add a submit button:

```html

```

Or a simple button like this:

```html
Sign in
```

Init this libarary:

```javascript
new DisableWith('data-disable-with');
```

Run your app and click the sign-in button. When the user is submitting the form, the sign-in button will be disabled, and the text will be changed to 'Signing in...' so that the user won't press it again until the server responds.

* Support with jQuery validation. Please view document [here](https://github.com/jquery-validation/jquery-validation)
* Support with `required` attribute. Won't action when required fields are empty.