KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have variable: var variableDynamic = 1; // or var variableDynamic = 1 + i++; Is there any way to use that to create dynamic variable names, for example something like this: var variableName + variableDynamic = {}; // or var (variableName + variableDynamic) = {}; I know what I wrote above is absurd, but this is to explain the idea. Is it possible? Ok, what I want to do to create element (upload form) every time user click on add new file group, everything is working fine except that plugin that I use for it need special variable for each upload form to trigger upload button (.uploadStoredFiles();). This is rough code I did: $('#addOneMoreFileOrGroup').on('click', function(){ var latestFileUploaderId = parseInt($('.well-large .file-uploader').last().attr('id').split('-')[2]) + 1; $('.well-large .control-group:last').after('<div class="control-group deal-type-online"> \ <label class="control-label">File / File Group Title:</label> \ <div class="controls"> \ <input class="span4 file-title" type="text"> \ <span class="question label label-warning" data-title="File / Group Name:" data-content="Name for your file or group of related files (for example your brand logotype in different file formats)." data-original-title="">?</span> \ <div id="file-uploader-' + latestFileUploaderId + '" class="file-uploader"></div> \ </div> \ </div>'); var HERE_I_NEED_DYNAMIC_VAR = new qq.FileUploader({ element: document.getElementById('file-uploader-' + latestFileUploaderId + ''), action: 'do-nothing.htm', autoUpload: false, debug: true, uploadButtonText: '<i class="icon icon-plus"></i> Select Files...', onSubmit: function() { $('#file-uploader-' + latestFile
Tags (comma-separated)
Save Edits
Cancel