Installation
<script src=""></script>
npm install arkjs
A lightweight JavaScript library for easy DOM manipulation and styling
<script src=""></script>
npm install arkjs
// Create a button
ARK.create('button')
.text('Click me')
.css({
padding: '10px 20px',
backgroundColor: '#4285f4',
color: 'white'
})
.on('click', () => alert('Hello ARKjs!'))
.appendTo('body');
ARK.create('div')
.text('Hello World!')
.css({ color: 'red', fontSize: '24px' })
.appendTo('#example1 .example-output');
ARK.create('button')
.text('Click Me')
.on('click', () => {
ARK.create('p')
.text('Button clicked!')
.appendTo('#example2 .example-output');
})
.appendTo('#example2 .example-output');
| Method | Description | Example |
|---|---|---|
ARK.create(tag, attributes) |
Creates a new element | ARK.create('div', { id: 'box' }) |
.attr(key, value) |
Sets or gets attributes | .attr('id', 'main') |
.css(property, value) |
Sets or gets styles | .css({ color: 'red' }) |
.text(content) |
Sets text content | .text('Hello') |
.appendTo(target) |
Appends to another element | .appendTo('#container') |
.on(event, handler) |
Adds event listener | .on('click', handler) |