aDom is a lightweight JavaScript library for DOM manipulation, inspired by jQuery. It provides a simple API for selecting elements, manipulating classes, setting styles, handling events, and more.
You can include aDom in your project by downloading the aDom script or by using the provided CDN link.
<script src="https://raw.githubusercontent.com/astola-studio/aDom/main/aDom.js"></script>Download the aDom.js file and include it in your project:
<script src="path/to/aDom.js"></script>aDom provides a simple and intuitive API for DOM manipulation. The library is accessible using the π symbol.
// Select elements with class 'my-class'
π('.my-class');// Add a class
π('.my-class').addClass('new-class');
// Remove a class
π('.my-class').removeClass('old-class');
// Toggle a class
π('.my-class').toggleClass('toggle-class');// Set a CSS property
π('.my-class').css('color', 'red');
// Get a CSS property
var color = π('.my-class').css('color');
console.log(color);// Set HTML content
π('.my-class').html('<p>New content</p>');
// Get HTML content
var html = π('.my-class').html();
console.log(html);// Add an event listener
π('.clickable').on('click', function() {
alert('Element clicked!');
});
// Remove an event listener
π('.clickable').off('click', function() {
alert('Element clicked!');
});We welcome contributions to improve aDom. Feel free to submit issues and pull requests on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.