# hotdom

> A lightweight library for DOM manipulation on modern browser using plain JavaScript

Latest version **1.2.0** (published 2021-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install hotdom
pnpm add hotdom
yarn add hotdom
bun add hotdom
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2021-06-28 |
| First published | 2021-06-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Hidayt Rahman |
| Maintainers | hidaytrahman |
| Keywords | DOM, javascript, hotdom, dom manipulation, dom-selector, html, es6, react, angular, vue |

## Links

- npm: https://www.npmjs.com/package/hotdom
- Repository: https://github.com/hidaytrahman/hotdom
- Homepage: https://github.com/hidaytrahman/hotdom#readme
- Issues: https://github.com/hidaytrahman/hotdom/issues
- npm.io page: https://npm.io/package/hotdom

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2021-06-28
- 1.1.0 — 2021-06-26
- 1.0.3 — 2021-06-26
- 1.0.2 — 2021-06-25
- 1.0.1 — 2021-06-25
- 1.0.0 — 2021-06-25

## README

# 🔥 hotdom

A lightweight library for DOM manipulation on modern browser using plain javascript.

## Install

**Requirements:**

- Node.js
- npm (Node.js package manager)

```
npm install hotdom --save
```
OR

```
yarn add hotdom
```

### usage

#### plug in your project

```javascript
import dom from 'hotdom'

let el = dom.selectById(id);

dom.getAttributes(el)

```

## Usage

### Selector

__selectByClass__

```javascript
const foo = dom.selectByClass('class-name');
```



__addClass()__

Add class on element

Takes three arguments, element, class and optional callback 
`  addClass(el, cls, callback) `

```javascript
const heading = dom.selectById('heading');

// add class 
dom.addClass(heading, 'common-heading');
```

__findIn()__

Find in children elements

Takes three arguments, element, css selector (class, id, tag and so on)
`   findIn(el, selector)  `

```javascript
const main = dom.selectById('main');

// find child element
dom.findIn(main, '.sub-main');

```

### Utils

__loadScript()__

The `loadScript()` loads js file dynamically.

It returns promise.

Takes `path-of-file` as a argument and loads file dynamically.

Example:
```javascript
import { loadScript } from 'hotdom'

// replace path with your own
loadScript('https://code.jquery.com/ui/1.12.1/jquery-ui.min.js)
 .then(() => {

 }).catch(() => console.error('Something went wrong.'));

```

__getUrlParameter()__

The `getUrlParameter()` returns value of matched key.

Takes `key` as a argument and returns value of matched key

Example:
```javascript
import { getUrlParameter } from 'hotdom'

// https://foo.com/?name=hidy
const params = getUrlParameter('name'); // hidy

```

## Documentation

[Get started](https://github.com/hidaytrahman/hotdom/wiki)



## Contributing
Create an [issue](https://github.com/hidaytrahman/hotdom/issues/new) if you find a bug or have a suggestion or question.

If you want to develop this project:

- Fork it!
- Create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request

---
_Source: https://npm.io/package/hotdom · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
