
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
vanilla-helpers
Advanced tools
A lightweight, production-ready vanilla JavaScript helper library for common website functionality. JavaScript often gets a bad reputation for being bloated, inaccessible, and unnecessary (and rightfully so when misused). However, there are legitimate cases where JavaScript is essential for advanced interactivity that HTML and CSS simply cannot handle alone. vanilla.js bridges this gap by providing secure, privacy-respecting, accessibility-compliant helper functions that follow modern web standards.
Unlike jQuery and other frameworks that add significant overhead, vanilla.js uses pure JavaScript with zero dependencies. It's white-label and framework-agnostic, making it perfect for any project, WordPress sites, static HTML, or modern web applications. Each function is self-contained and can be copied individually if you only need specific functionality. The library auto-initializes on page load and uses data attributes exclusively, so there are no class name conflicts with your CSS frameworks. Whether you're an experienced developer looking to avoid repetitive code, or a non-developer who just needs to add a modal or accordion to your site, vanilla.js provides plug-and-play solutions that just work.
Direct Download:
Download vanilla.js and include it in your HTML:
<script src="vanilla.js"></script>
CDN:
<script src="https://unpkg.com/vanilla-js"></script>
Add/remove/toggle classes on elements for show/hide functionality and state management.
<button data-toggle-class="is-active" data-toggle-target="#menu">Toggle Menu</button>
Close and remove alert banners, notifications, or any dismissible content.
<div data-dismissible>
<p>This is an alert message</p>
<button data-dismiss>×</button>
</div>
Automatically show/hide a back-to-top button based on scroll position with smooth scrolling.
<button data-back-to-top>Back to Top</button>
Show/hide password input text with a toggle button.
<input type="password" id="pwd">
<button data-password-toggle="#pwd">Show Password</button>
Copy text to clipboard with visual feedback.
<!-- Copy from data attribute -->
<button data-copy="Text to copy">Copy</button>
<!-- Copy from another element -->
<button data-copy-target="#code-snippet">Copy Code</button>
<pre id="code-snippet">console.log('Hello');</pre>
Automatically detect external links and open them in a new tab with proper security attributes.
<!-- Automatically detected and enhanced -->
<a href="https://example.com/">External Link</a>
<!-- Prevent external handling -->
<a href="https://example.com/" data-internal>Stay in Tab</a>
Make any element with tabindex="0" fully keyboard accessible (Enter and Space key support).
<div tabindex="0" onclick="doSomething()">Clickable div</div>
Enhance smooth scrolling anchor links with offset support for fixed headers.
<!-- Basic smooth scroll -->
<a href="#section">Scroll to Section</a>
<!-- With offset for fixed header -->
<a href="#section" data-scroll-offset="80">Scroll to Section</a>
Automatically wrap videos in aspect-ratio containers for responsive embedding.
<!-- 16:9 aspect ratio (default) -->
<iframe data-responsive-video="16:9" src="https://youtube.com/embed/..."></iframe>
<!-- 4:3 aspect ratio -->
<video data-responsive-video="4:3" src="video.mp4"></video>
Disable form buttons and show loading text during form submission.
<form data-loading-form action="/submit" method="post">
<button data-loading-button data-loading-text="Sending...">Submit</button>
</form>
Toggle mobile navigation menus with proper ARIA attributes.
<button data-nav-toggle="main-nav" aria-expanded="false">Menu</button>
<nav data-nav="main-nav">
<!-- Navigation items -->
</nav>
Real-time client-side form validation with custom error messages and password matching.
<form data-validate-form>
<input type="email" required>
<input type="password" id="pwd" required>
<input type="password" data-validate-match="#pwd" required>
<button type="submit">Submit</button>
</form>
Expandable/collapsible content sections with optional "close others" behavior.
<div data-accordion data-accordion-close-others="true">
<button data-accordion-trigger aria-expanded="false">Question 1</button>
<div data-accordion-content>Answer 1</div>
<button data-accordion-trigger aria-expanded="false">Question 2</button>
<div data-accordion-content>Answer 2</div>
</div>
Keyboard and touch accessible dropdown navigation menus.
<div data-dropdown>
<button data-dropdown-trigger aria-expanded="false">Menu</button>
<ul data-dropdown-menu>
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
</ul>
</div>
Accessible modal popups with focus trapping and keyboard support.
<button data-modal-open="signup">Open Modal</button>
<div data-modal="signup" data-modal-close-esc="true" data-modal-close-overlay="true" aria-hidden="true">
<button data-modal-close>×</button>
<h2>Modal Content</h2>
<p>Your content here...</p>
</div>
Click any image to view it in a fullscreen overlay with keyboard navigation.
<!-- Use current src -->
<img src="image.jpg" data-lightbox alt="Description">
<!-- Use different full-size image -->
<img src="thumb.jpg" data-lightbox="full-size.jpg" alt="Description">
Modern evergreen browsers (last 2 versions):
Public Domain (use freely)
FAQs
A lightweight vanilla JavaScript helper library
The npm package vanilla-helpers receives a total of 10 weekly downloads. As such, vanilla-helpers popularity was classified as not popular.
We found that vanilla-helpers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.