我有一个简单的 jquery 脚本,它允许我在上传的文件旁边创建文本框
$(function(){
//------------- Plupload php upload -------------//
// Setup html4 version
$("#html4_uploader").pluploadQueue({
// General settings
runtimes : 'html4',
url : '../../assets/dashboard/php/upload.php',
max_file_size : '10mb',
max_file_count: 15, // user can add no more then 15 files at a time
chunk_size : '5mb',
multiple_queues : true,
// Rename files by clicking on their titles
rename: true,
// Sort files
sortable: true,
});
var uploader = $('#html4_uploader').pluploadQueue();
uploader.bind('FileUploaded', function(up, file, info) {
if (uploader.files.length == (uploader.total.uploaded + uploader.total.failed)) {
$('.gradient').hide();
form = '<form class="form-horizontal" id="form-validate" novalidate="novalidate" method="post">';
length = uploader.files.length;
files = uploader.files;
for (var i = 0; i <= length-1; i++) {
form+= '<div class="alert alert-success" id="message" style="display:none;"></div>';
form+= '<div class="form-row row-fluid">';
form+= '<div class="span12">';
form+= '<div class="row-fluid">';
form+= '<label class="form-label span3" for="medianame">File Title</label>';
form+= '<input class="span3 text" id="medianame'+i+'" name="mediatitle[]" type="text">';
form+= '<input type="hidden" name="mediapath[]" value="'+files[i].name+'" >';
form+= '<strong style="margin-right:20px;" >'+files[i].name+'</strong>';
form+= '</div>';
form+= '</div>';
};
form+= '<div class="form-row row-fluid">';
form+= '<div class="span12">';
form+= '<div class="row-fluid">';
form+= '<div class="form-actions">';
form+= '<div class="span3"></div>';
form+= '<div class="span9 controls">';
form+= '<button type="submit" id="submit" class="btn marginR10" style="margin:10px;" >Save</button>';
form+= '<button class="btn btn-danger">Delete</button>';
form+= '</div>';
form+= '</div>';
form+= '</div>';
form+= '</div>';
form+= '</div>';
form+= '</form>';
$('#multiform').html(form);
$('#submit').click(function()
{
$.ajax
({
type: "POST",
url: "",
dataType: "json",
data: $('form').serialize(),
cache: false,
beforeSend: function()
{
$('#message').hide();
},
success: function(data)
{
if(data.response)
{
$('#message').show().html(data.message);
}
}
});
return false;
});
}
});
});
该脚本工作正常,但在创建文本框时有一个问题
第一个文本框工作正常,但所有其他框都被禁用我无法单击它们来编写文本
我试图修改它很多时间但我可以不知道为什么会出现这个问题