could someone explain overwriting default properties and even extending them with jQuery inside my plugin example and also the closure function
$.fn.myObject = function(overwriteProperties) {
var properties = {myproperty1: "defaultvalue"}
// overwrite properties here
function doStuffHere() {
}
return (function() {
return this; // does this part here refer to the object of myDiv
});
}
$('#myDiv').myObject({myPoperty1:"newValue"});
You can use jQuery's extend
to overwrite the default options:
var options = $.extend({}, defaults, options);
Also see:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With