lib/abaaso.js
function ( obj, value ) {
		var event = "input",
		    output;

		if ( value === undefined ) {
			if ( regex.radio_checkbox.test( obj.type ) ) {
				if ( string.isEmpty( obj.name ) ) {
					throw new Error( label.error.expectedProperty );
				}

				array.each( utility.$( "input[name='" + obj.name + "']" ), function ( i ) {
					if ( i.checked ) {
						output = i.value;
						return false;
					}
				});
			}
			else if ( regex.select.test( obj.type ) ) {
				output = obj.options[obj.selectedIndex].value;
			}
			else if ( "value" in obj ) {
				output = obj.value;
			}
			else {
				output = element.text( obj );
			}

			if ( output !== undefined ) {
				output = utility.coerce( output );
			}

			if ( typeof output === "string" ) {
				output = string.trim( output );
			}
		}
		else {
			value = value.toString();

			if ( regex.radio_checkbox.test( obj.type ) ) {
				event = "click";

				array.each( utility.$( "input[name='" + obj.name + "']" ), function ( i ) {
					if ( i.value === value ) {
						i.checked = true;
						output = i;
						return false;
					}
				});
			}
			else if ( regex.select.test( obj.type ) ) {
				event = "change";

				array.each( element.find( obj, "> *" ), function ( i ) {
					if ( i.value === value ) {
						i.selected = true;
						output = i;
						return false;
					}
				});
			}
			else {
				obj.value !== undefined ? obj.value = value : element.text( obj, value );
			}

			element.dispatch( obj, event );

			output = obj;
		}

		return output;
	}
function ( obj, value ) {
		var event = "input",
		    output;

		if ( value === undefined ) {
			if ( regex.radio_checkbox.test( obj.type ) ) {
				if ( string.isEmpty( obj.name ) ) {
					throw new Error( label.error.expectedProperty );
				}

				array.each( utility.$( "input[name='" + obj.name + "']" ), function ( i ) {
					if ( i.checked ) {
						output = i.value;
						return false;
					}
				});
			}
			else if ( regex.select.test( obj.type ) ) {
				output = obj.options[obj.selectedIndex].value;
			}
			else if ( "value" in obj ) {
				output = obj.value;
			}
			else {
				output = element.text( obj );
			}

			if ( output !== undefined ) {
				output = utility.coerce( output );
			}

			if ( typeof output === "string" ) {
				output = string.trim( output );
			}
		}
		else {
			value = value.toString();

			if ( regex.radio_checkbox.test( obj.type ) ) {
				event = "click";

				array.each( utility.$( "input[name='" + obj.name + "']" ), function ( i ) {
					if ( i.value === value ) {
						i.checked = true;
						output = i;
						return false;
					}
				});
			}
			else if ( regex.select.test( obj.type ) ) {
				event = "change";

				array.each( element.find( obj, "> *" ), function ( i ) {
					if ( i.value === value ) {
						i.selected = true;
						output = i;
						return false;
					}
				});
			}
			else {
				obj.value !== undefined ? obj.value = value : element.text( obj, value );
			}

			element.dispatch( obj, event );

			output = obj;
		}

		return output;
	}
function ( obj , value ) { var event = "input" , output ; if ( value === undefined ) { if ( regex . radio_checkbox . test ( obj . type ) ) { if ( string . isEmpty ( obj . name ) ) { throw new Error ( label . error . expectedProperty ) ; } array . each ( utility . $ ( "input[name='" + obj . name + "']" ) , function ( i ) { if ( i . checked ) { output = i . value ; return false ; } } ) ; } else if ( regex . select . test ( obj . type ) ) { output = obj . options [ obj . selectedIndex ] . value ; } else if ( "value" in obj ) { output = obj . value ; } else { output = element . text ( obj ) ; } if ( output !== undefined ) { output = utility . coerce ( output ) ; } if ( typeof output === "string" ) { output = string . trim ( output ) ; } } else { value = value . toString ( ) ; if ( regex . radio_checkbox . test ( obj . type ) ) { event = "click" ; array . each ( utility . $ ( "input[name='" + obj . name + "']" ) , function ( i ) { if ( i . value === value ) { i . checked = true ; output = i ; return false ; } } ) ; } else if ( regex . select . test ( obj . type ) ) { event = "change" ; array . each ( element . find ( obj , "> *" ) , function ( i ) { if ( i . value === value ) { i . selected = true ; output = i ; return false ; } } ) ; } else { obj . value !== undefined ? obj . value = value : element . text ( obj , value ) ; } element . dispatch ( obj , event ) ; output = obj ; } return output ; }
Gets or sets the value of Element

@method val
@param  {Mixed}  obj   Element
@param  {Mixed}  value [Optional] Value to set
@return {Object}       Element
Gets or sets the value of Element