How can I do this in one line?
var myOptions = defaultOptions;
$.extend(myOptions, {width: 200});
$("#myField").foo(myOptions);
I dont want to make any changes to defaultOptions. I do not need myOptions anywhere else.
var newSettings = $.extend({}, defaultOptions, { width: 200 });
$('#myfield').foo(newSettings);
Or
$('#myfield').foo($.extend({}, defaultOptions, { width: 200 }));