====== Manipulate ====== Using these methods, you can change the contents and order of the DOM tree. ===== html( ) ===== Returns the innerHTML of the first element in Karmagination.
Hi
alert(Karma('#one').html()); // Hi ===== html( val ) ===== Sets the innerHTML of the elements to val.
a
b
Karma('div').html('hi'); alert(Karma('div').eq(0).html()); // hi ===== text( ) ===== Returns the innerText of the first element.
a b
Karma('div').text(); // returns 'a b' ===== text( val ) ===== Change the innerText of the elements. Karma('div').text('hello'); Karma('div').text(); // returns 'hello' ===== append( content ) ===== Appends content (element/elements/html) to current set of elements ===== appendTo( selector ) ===== Appends current set of elements to the elements that are matched by the selector (element/elements/html) ===== prepend( content ) ===== Prepends content (element/elements/html) to current set of elements ===== prependTo( selector ) ===== Prepends current set of elements to the elements that are matched by the selector ===== after( content ) ===== Inserts the elements that matches the selector after current elements. ===== before( content ) ===== Inserts the elements that matches the selector before current elements. ===== insertAfter( selector ) ===== Inserts current elements after the elements that matches the selector (element/elements/html). ===== insertBefore( selector ) ===== Inserts current elements before the elements that matches the selector (element/elements/html). ===== wrap( html ) ===== Wrap the current elements with the html. Note: Karmagination only supports unnested html, ie:
but not
===== empty( ) ===== Removes all the descendants of the current elements. ===== remove( [selector] ) ===== Removes current elements that matches the selector from the document. ===== clone( ) ===== Make clones of the current elements. Event cloning is not supported yet.