* $( '#textbox' ).suggestions( { option1: value1, option2: value2 } );
* $( '#textbox' ).suggestions( option, value );
*
- * Get option:
- *
- * value = $( '#textbox' ).suggestions( option );
- *
* Initialize:
*
* $( '#textbox' ).suggestions();
// See file header for method documentation
$.fn.suggestions = function () {
-
// Multi-context fields
- var returnValue,
- args = arguments;
+ var args = arguments;
$( this ).each( function () {
var context, key;
if ( args.length > 1 ) {
// Set property values
$.suggestions.configure( context, args[ 0 ], args[ 1 ] );
- } else if ( returnValue === null || returnValue === undefined ) {
- // Get property values, but don't give access to internal data - returns only the first
- returnValue = ( args[ 0 ] in context.config ? undefined : context.config[ args[ 0 ] ] );
}
}
}
// Store the context for next time
$( this ).data( 'suggestions-context', context );
} );
- return returnValue !== undefined ? returnValue : $( this );
+ return this;
};
/**