diff options
| author | spiderr <spiderr@bitweaver.org> | 2026-03-01 18:36:46 -0500 |
|---|---|---|
| committer | spiderr <spiderr@bitweaver.org> | 2026-03-01 18:36:46 -0500 |
| commit | aa3f0490c31de84f3ea66d0e02148b03971dab13 (patch) | |
| tree | d36e24b61ff2a3438d7eb832b8da89681d72748f | |
| parent | 4f8f464db8f781e5a7f5b02812fed64e290fbf45 (diff) | |
| download | util-aa3f0490c31de84f3ea66d0e02148b03971dab13.tar.gz util-aa3f0490c31de84f3ea66d0e02148b03971dab13.tar.bz2 util-aa3f0490c31de84f3ea66d0e02148b03971dab13.zip | |
add showByClass, hideByClass js functions
| -rw-r--r-- | javascript/bitweaver.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/javascript/bitweaver.js b/javascript/bitweaver.js index 77af16d..09977cc 100644 --- a/javascript/bitweaver.js +++ b/javascript/bitweaver.js @@ -236,6 +236,31 @@ BitBase = { return value != 'none'; }, + /** + * Hides all elements that have the specified class name + * @param className The class name of the elements to hide + */ + "hideByClass": function( className ) { + var elements = document.getElementsByClassName(className); + for (var i = 0; i < elements.length; i++) { + elements[i].style.display = 'none'; + } + }, + + /** + * Shows all elements that have the specified class name + * @param className The class name of the elements to show + * @param displayType Optional: The display style to use (e.g., 'block', 'inline'). Defaults to '' (CSS default). + */ + "showByClass": function(className, displayType) { + var elements = document.getElementsByClassName(className); + // If displayType is not provided (undefined/null), it defaults to 'block' + var display = displayType || 'block'; + for (var i = 0; i < elements.length; i++) { + elements[i].style.display = display; + } + }, + // desc: convenience // params: elm - ad DOM element or id / useCookie = any value (not 0 or null) to turn cookies on "showById": function( elm, useCookie ) { |
