DEV Community

Sh Raj
Sh Raj

Posted on • Updated on • Originally published at github.com

QueryX: A Lightweight JavaScript Library for DOM Manipulation

Introducing QueryX: A Lightweight JavaScript Library for DOM Manipulation

As developers, we often find ourselves needing to manipulate the DOM to create dynamic and interactive web applications. That's where QueryX comes in – a lightweight JavaScript library that provides a jQuery-like interface for DOM manipulation and traversal.

GitHub logo SH20RAJ / QueryX

QueryX is a lightweight JavaScript library that provides a jQuery-like interface for DOM manipulation and traversal. It allows you to select elements, add/remove classes, manipulate attributes, traverse the DOM, and more, similar to jQuery but in a simpler and more lightweight manner.

QueryX

GitHub license GitHub issues GitHub stars GitHub forks

QueryX is a lightweight JavaScript library that provides a jQuery-like interface for DOM manipulation and traversal. It allows you to select elements, add/remove classes, manipulate attributes, traverse the DOM, and more, similar to jQuery but in a simpler and more lightweight manner.

Dev.to

Features

  • DOM Selection: Select elements from the DOM using CSS selectors.
  • DOM Manipulation: Add, remove, and modify elements and their attributes.
  • Event Handling: Attach and detach event handlers to elements.
  • DOM Traversal: Traverse the DOM tree with ease.
  • Chaining: Chain multiple operations together for cleaner code.

Getting Started

To get started with QueryX, include the queryX.js file in your project:

<script src="path/to/queryX.js"></script>
Enter fullscreen mode Exit fullscreen mode

Alternatively, you can use a CDN link:

<script src="https://cdn.jsdelivr.net/gh/SH20RAJ/QueryX@main/QueryX.js"></script>
Enter fullscreen mode Exit fullscreen mode

or

<script src="https://cdn.jsdelivr.net/npm/queryxjs"></script>
Enter fullscreen mode Exit fullscreen mode

Usage

// Example Usage
queryX('button')
…
Enter fullscreen mode Exit fullscreen mode

https://sh20raj.github.io/QueryX/

What is QueryX?

QueryX offers a simplified and more lightweight alternative to jQuery, with a focus on ease of use and efficiency. Whether you're selecting elements, adding or removing classes, manipulating attributes, or traversing the DOM tree, QueryX has got you covered.

Features

  • DOM Selection: Easily select elements using CSS selectors.
  • DOM Manipulation: Add, remove, and modify elements and their attributes.
  • Event Handling: Attach and detach event handlers to elements.
  • DOM Traversal: Traverse the DOM tree with ease.
  • Chaining: Chain multiple operations together for cleaner code.

Why Choose QueryX?

  1. Lightweight: QueryX is designed to be lightweight and efficient, making it ideal for projects where performance matters.
  2. Simplified Syntax: Say goodbye to verbose code. QueryX provides a clean and intuitive syntax for DOM manipulation.
  3. Versatile: From simple tasks like adding a class to complex DOM traversal, QueryX offers a wide range of methods to handle various scenarios.
  4. Easy to Learn: If you're familiar with jQuery, you'll feel right at home with QueryX. The syntax is similar, making it easy to transition.

Getting Started

To get started with QueryX, include the queryX.js file in your project:

<script src="path/to/queryX.js"></script>
Enter fullscreen mode Exit fullscreen mode

Alternatively, you can use a CDN link:

<script src="https://cdn.jsdelivr.net/gh/SH20RAJ/QueryX@main/QueryX.js"></script>

Enter fullscreen mode Exit fullscreen mode

or

<script src="https://cdn.jsdelivr.net/npm/queryxjs"></script>
Enter fullscreen mode Exit fullscreen mode

Example Usage

Here are a few examples to showcase QueryX's capabilities:

Adding a Class

queryX('div').addClass('highlight');
Enter fullscreen mode Exit fullscreen mode

Appending Content

queryX('.container').append('<div class="new-element">New Element</div>');
Enter fullscreen mode Exit fullscreen mode

Event Handling

queryX('button').on('click', function() {
    queryX(this).toggleClass('active');
});
Enter fullscreen mode Exit fullscreen mode

Contribution and Feedback

QueryX is an open-source project, and contributions are welcome! If you have suggestions, bug reports, or feature requests, feel free to open an issue or submit a pull request on GitHub.

Try QueryX Today!

Ready to simplify your DOM manipulation? Give QueryX a try in your next project! Visit the GitHub repository to get started.

Happy coding with QueryX!

Top comments (0)