Skip to content

ZeroXiphYT/xerojs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

xeroJS

It is Work In Progress So There Is Going To be More added

This is a jquery clone I made
To add this to your project download or clone this repository then add lib.js to your editor and put in in your html file put <script src="path to lib.js"></script> OR use this link: https://zeroxiphyt.github.io/xerojs/lib.js like a cdn BEFORE any your actual javascript.

How To Use

Basics

Selecting an element

//selecting an element
$('element')
//selecting an element with id
$('#id')
//selecting an element with class
$('.class')
//selecting an attribute
$('[class="class"]')
//You can combine them like how you do with querySelector

Hide and show

//hide hides the element using display:none
$('element').hide()
//show shows the element by using display:block
$('element').show()

HTML

HTML and setHTML

//returns elements html
$('element').html()
//set html with setHTML(code)
$('element').setElement('<p>Example On Some Code</p>')

Attributes

classes and id

//class
$('element').addClass('class')
//id
$('element').addId('id)

src and style

//src
$('element').src('src')
//style
$('element').style('color', 'cyan')

value

//returns the value of an element
$('element').value()

attr

$('element').attr('id', 'whatever')
//if the value is null it will use get an attribute instead of setting an attribute

Other

on

//basically addEventListener
$('button').on('click', function(){
console.log('something')
})
//or
$('button').on('click', doSomething)
function doSomething(){
console.log('something')
})
//you get the idea

createChld(It is createChld and not createChild, not a spelling mistake)

//syntax is createChld(childElement, id, class, innerHTML)
$('div').createChld('p', 'id', 'class', 'Hello or <strong>Hello</strong>')

lg

//just logs to a div with the id of log
lg('message')

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published