2.2.5 • Published 9 months ago

@carry0987/check-box v2.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

CheckBox-JS

version CI
A library for create and manage checkbox elements

Installation

pnpm i @carry0987/check-box

Usage

Here is a simple example to use CheckBox-JS

UMD

<div id="app">
    <input type="checkbox" id="check-all" title="Check All">
    <div class="check-box-list">
        <input type="checkbox" name="check-no-title" checked>
        <input type="checkbox" name="check-1" data-checkbox-id="check-1" value="Test-1">
        <label data-checkbox-for="check-1" class="test">Check-1</label>
        <input type="checkbox" name="check-2" id="check-2" value="Test-2">
        <label for="check-2">Check-2</label>
        <input type="checkbox" name="check-3" id="check-3" value="Test-3">
        <label for="check-3">Check-3</label>
    </div>
    <input type="checkbox" id="check-all-2" title="Check All">
</div>
<link rel="stylesheet" href="dist/theme/checkBox.min.css">
<script src="dist/checkBox.min.js"></script>
<script type="text/javascript">
let checkBox = new checkBoxjs.CheckBox('#app .check-box-list input', {
    bindLabel: true,
    checkAll: ['#check-all', '#check-all-2'],
    allowShiftKey: true,
    onChange: (total, target) => {
        console.log(target);
        if (target) console.log(target);
    },
    onCheckAll: (total) => {
        console.log(total);
    },
    styles: {
        '#check-all ~ label': {
            fontWeight: 'bold'
        }
    }
});
checkBox.onChange = (total, target) => {
    console.log('Total: ', total);
    if (target) console.log(target);
};
document.getElementById('version').innerText = checkBoxjs.CheckBox.version;
</script>

ES Module

import { CheckBox } from '@carry0987/check-box';
import '@carry0987/check-box/theme/checkBox.min.css';

let checkBox = new CheckBox('#app .check-box-list input', {
    //...
});
2.2.5

9 months ago

2.2.4

9 months ago

2.2.1

9 months ago

2.2.0

9 months ago

2.1.1

9 months ago

2.2.3

9 months ago

2.2.2

9 months ago

2.1.0

10 months ago

2.0.13

1 year ago

2.0.12

1 year ago

2.0.11

1 year ago

2.0.10

1 year ago

2.0.9

1 year ago

2.0.7

1 year ago

2.0.8

1 year ago

2.0.5

1 year ago

2.0.6

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.2.5

1 year ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago