From 5b7001b393dfa27f4c255aa80a647ab0225e3bfc Mon Sep 17 00:00:00 2001 From: laurisnet Date: Tue, 10 Nov 2015 15:24:04 +0200 Subject: [PATCH] Added possibility to set extraData after plugin init --- README.md | 6 ++++++ src/dmuploader.js | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 5c69660..06b62d7 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,12 @@ $("#drop-area-div").dmUploader(options); This way you can initialize the plugin. As parameter you can set all variables you want and the same goes for callbacks; down bellow you can see a list of what [options](#options) and [callbacks](#callbacks) are availabe. +````javascript +$("#drop-area-div").data('dmUploader').({ galleryID: 1 }); +```` + +This way you can set extraData AFTER dmUploader has initialized. Its useful for dropdowns. + ##Markup This is the simple html markup. The file input is optional but it provides an alternative way to select files for the user(check the online demo to se how to hide/style it) ````html diff --git a/src/dmuploader.js b/src/dmuploader.js index 1331129..ab61a08 100644 --- a/src/dmuploader.js +++ b/src/dmuploader.js @@ -275,6 +275,13 @@ }); } + DmUploader.prototype.setExtraData = function(options) + { + if( typeof options === 'undefined' ) return; + + this.settings.extraData = options; + } + $.fn.dmUploader = function(options){ return this.each(function(){ if(!$.data(this, pluginName)){