# jquery-form-readonly

> A jQuery plug-in that makes HTML form elements read-only.

Latest version **0.1.0** (published 2018-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install jquery-form-readonly
pnpm add jquery-form-readonly
yarn add jquery-form-readonly
bun add jquery-form-readonly
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-02-10 |
| First published | 2018-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 87.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | mozq |
| Keywords | html, form, readonly, jquery-plugin, browser, ecosystem:jquery |

## Links

- npm: https://www.npmjs.com/package/jquery-form-readonly
- Repository: https://github.com/mozq/jquery-form-readonly
- Homepage: https://mozq.github.io/jquery-form-readonly/
- Issues: https://github.com/mozq/jquery-form-readonly/issues
- npm.io page: https://npm.io/package/jquery-form-readonly

## Dependencies (1)

- [jquery](https://npm.io/package/jquery.md) ^3.3.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2018-02-10

## README

[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://raw.githubusercontent.com/mozq/jquery-form-readonly/master/LICENSE.txt)

# jquery-form-readonly

This is a jQuery plug-in that makes HTML form elements read-only.


## Usage

### Install

Include jquery-form-readonly after jQuery library.

    <script src="//code.jquery.com/jquery-3.2.1.js"></script> <!-- jQuery -->
    <script src="//cdn.jsdelivr.net/gh/mozq/jquery-form-readonly@0.1.0/dist/jquery.form-readonly.min.js"></script> <!-- jquery-form-readonly -->

### Enable read-only

Please call .formReadonly() method.

    $('form').formReadonly();

You can apply this method for any jQuery elements.

    $('input[type="text"]').formReadonly();
    $('div.fooClass').formReadonly();
    $('#barId').formReadonly();

The following elements contains in jQuery elements is to be processed.

|Element  |Type                                  |
|---------|--------------------------------------|
|input    |text, password, checkbox, radio, file |
|textarea |N/A                                   |
|select   |N/A                                   |

#### Options

You can specify following options.

|Option             |Type                    |Description                                   |Default value  |
|-------------------|------------------------|----------------------------------------------|---------------|
|multipleSeparator  |string, element, etc... |Separator of multiple value                   |', '           |
|passwordMaskChar   |string                  |Character of password mask                    |'*'            |
|passwordMaskLength |number                  |Fixed length of password                      |-1 (not fixed) |
|useLabel           |boolean                 |Use label when presented by checkbox or radio |false          |
|includesReadonly   |boolean                 |Includes read-only form elements to target    |false          |
|includesDisabled   |boolean                 |Includes disabled form elements to target     |false          |
|excludes           |function(p1)            |Function to exclude form elements             |null           |

Sample code:

    $('form').formReadonly({
      multipleSeparator: $('<br>'),
      passwordMaskChar: '#',
      passwordMaskLength: 16,
      useLabel: true,
      includesReadonly: true,
      includesDisabled: true,
      excludes: function ($elm) { return ($elm.prop('type') === 'radio'); },
    });

### Cancel read-only

Specifying false for the argument cancels read-only.

    $('form').formReadonly(false);


## License

The jquery-form-readonly is open-sourced software licensed under the [MIT license](https://raw.githubusercontent.com/mozq/jquery-form-readonly/master/LICENSE.txt).

---
_Source: https://npm.io/package/jquery-form-readonly · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
