KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Currently I'm writing a jQuery plugin with some options. An example simplified piece of code from a web page: <div id="div1"></div> <div id="div2"></div> $(document).ready(function(){ $("#div1").myFunc({width: 100, height: 100}); $("#div2").myFunc({width: 200, height: 200}); }); And here's a (again simplified) plugin code: (function($) { $.fn.myFunc = function(options) { // extending default settings var options = $.extend( { width: 300, height: 200 }, options); return this.each(function() { // doing something for example with #div1 $(this).click(function() { // here I need to access ANOTHER (e.g. #div2) object's options // how can I do it? }); }); } })(jQuery); Well, the question is in the listing - how can I access another object's options from inside the plugin's function? Something like $("#div2").options.width
Tags (comma-separated)
Save Edits
Cancel