Skip to content

Commit

Permalink
Add loaded option
Browse files Browse the repository at this point in the history
  • Loading branch information
carry0987 committed Nov 4, 2023
1 parent e3780cc commit bdcfe5f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/radioBox.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ <h1>Other Radio Input</h1>
'.radio-box': {
'margin-bottom': '5px'
}
},
loaded: (radioBox) => {
console.log(radioBox.value);
}
});
radioBox2.onChange = (e) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carry0987/radio-box",
"version": "1.5.7",
"version": "1.5.8",
"description": "A library for create radio type check box",
"type": "module",
"main": "dist/radioBox.min.js",
Expand Down
4 changes: 4 additions & 0 deletions src/radioBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ class RadioBox {
this.elements.push(cloneEle); // Store each radio input box
});

// Handle radio loaded
if (this.option.loaded) this.option.loaded(this);

return this;
}

Expand Down Expand Up @@ -150,6 +153,7 @@ RadioBox.version = '__version__';
RadioBox.instance = [];
RadioBox.defaultOption = {
checked: null,
loaded: null,
onChange: null,
bindLabel: true,
styles: {}
Expand Down

0 comments on commit bdcfe5f

Please sign in to comment.