Version: 1.0.1
Author: Khin Maung Win
License: MIT
Standalone utility library for all websites.
Provides handy helper functions for DOM manipulation, cookies, localStorage, events, and more.
- DOM selectors and class management
- Event listener helpers
- Cookie get/set/delete
- URL query parameters parser
- Fetch JSON wrapper (GET)
- String utilities: capitalize, truncate
- Debounce and throttle functions
- Date formatting
- Smooth scrolling
- LocalStorage helpers
Include in your project: CDN
<script src="https://cdn.jsdelivr.net/gh/kokhinmaungwin/webutils-library@v1.0.1/dist/webutils.js"></script>Or import as a module (Node.js / bundler):
const WebUtils = require('./webutils');// Select one element
const header = WebUtils.$('header');
// Add class
WebUtils.addClass(header, 'active');
// Get URL query parameters
const params = WebUtils.getQueryParams();
// Fetch JSON data
WebUtils.fetchJson('/api/data').then(data => console.log(data));API Reference
See the source code comments for detailed API descriptions.
MIT © Khin Maung Win