Mini DOM manipulations like jquery
- css, rawCss, attr, getAttr, removeAttr, animate, on, addClass, toggleClass, html
- text, val, insertBefore, insertAfter, insertFirst, insertLast, empty, fetch
- Total (18)
for use you can first initialise with
select(document).ready(function(){
//code here
});
- css
select(selector).css(style,textStyle);
// example
select('#idname').css('display','none');
- rawCss
select(selector).rawCss(style);
// example
select('.classname').rawCss('display:none;border:1px solid black');
- attr
select(selector).attr(attribute_name,value);
// example
select('.classname').attr('value','1234');
- getAttr
select(selector).getAttr(attribute_name);
// example
select('.classname').getAttr('value');
- removeAttr
select(selector).removeAttr(attribute_name);
// example
select('.classname').removeAttr('value');
- animate
select(selector).animate(time, scale, rotate, rotateX, rotateY, translateX, translateY, skewX, skewY, opacity);
// example
select('.classname').animate('3', '1','0','360','1','0','0', '0','0','1');
- on
select(selector).on(event_name,function(){
// expresion
});
// example
select('button').on('click',function(){
// expresion
});
- addClass
select(selector).addClass(class_name);
// example
select('#lastname').addClass('name');
- toggleClass
select(selector).toggleClass(class_name);
// example
select("button").on('click',function(){
select(selector).toggleClass(class_name);
});
- html
select(selector).html(element);
// example
select('.classname').html('<p>paragraf</p>');
- text
select(selector).text(text);
// get text value
select(selector).text();
// example
select('.textarea').text('this value');
- value
select(selector).val(val);
// get value
select(selector).val();
// example
select('.inputclass').val('this value');
- insertBefore
select(selector).insertBefore(beforeBegin);
// example
select('p').insertBefore('<i>before begin</i>');
- insertAfter
select(selector).insertAfter(afterEnd);
// example
select('p').insertAfter('<i>after End</i>');
- insertFirst
select(selector).insertFirst(afterBegin);
// example
select('p').insertFirst('<i>after Begin</i>');
- insertLast
select(selector).insertLast(beforeEnd);
// example
select('p').insertLast('<i>Before End</i>');
- empty
select(selector).empty();
// example
select('.classname').empty();
- fetch use this template fetch https://github.com/yaza-putu/fetch-template , fetch like ajax jquery