Skip to content

Commit

Permalink
Added show() and hide() methods to the UmbrellaJs selector.
Browse files Browse the repository at this point in the history
  • Loading branch information
feuzeu committed Jun 20, 2024
1 parent 95f24c1 commit 3712052
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
9 changes: 5 additions & 4 deletions dist/jaxon.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1449,22 +1449,23 @@ window.jaxon = jaxon;
if (!el.options || !el.multiple) {
return el.value;
}
return el.options
// Convert from NodeList to array, so we can call the filter method.
return [...el.options]
.filter((option) => option.selected)
.map((option) => option.value);
};
selector.prototype.show = function() {
selector.prototype.show = function(display) {
this.each(node => {
if (node.style) {
node.style.visibility = 'visible';
node.style.display = display ?? 'block';
}
});
return this;
};
selector.prototype.hide = function() {
this.each(node => {
if (node.style) {
node.style.visibility = 'hidden';
node.style.display = 'none';
}
});
return this;
Expand Down
Loading

0 comments on commit 3712052

Please sign in to comment.