====== Attributes ======
The methods described will allow you to change the attributes of the elements.
===== attr( name ) =====
Returns the attribute name's value of the first element.
alert(Karma('div').attr('title')); // fun
===== attr( name, value ) =====
Change the attribute value of the elements.
Karma('div').attr('title', 'fun');
alert(Karma('div').attr('title')); // fun
===== attr( object ) =====
Iterate through the object key value pair and change the attribute value of the elements.
Karma('div').attr({
'title': 'fun',
'id': 'unique',
'lang': 'en'
});
alert(Karma('div').attr('title')); // fun
alert(Karma('div').attr('id')); // unique
alert(Karma('div').attr('lang')); // en
===== addClass( string ) =====
Adds string to the current class attribute
Karma('div').addClass('another');
alert(Karma('div')[0].className); // "only another"
===== removeClass( string ) =====
Removes string to the current class attribute
Karma('div').removeClass('second');
alert(Karma('div')[0].className); // "first third"
===== hasClass( string ) =====
Returns true if first element's class attribute contains string, else returns false
alert(Karma('div').hasClass('second')); // true
===== toggleClass( string ) =====
Removes string from class attribute if string is not found in the attributes, adds otherwise.
Karma('div').toggleClass('second');
alert(Karma('div')[0].className); // "first third"
Karma('div').toggleClass('second');
alert(Karma('div')[0].className); // "first third second"
===== val( ) =====
Gets the value of input elements
alert(Karma('input').val()); // Hi
===== val( name ) =====
Gets the value of input elements
Karma('input').val('hi');
alert(Karma('input').val()); // Hi