jquery.form.js-如何解除此表格的绑定 [英] jquery.form.js - how can I unbind this form
问题描述
我在此网站上使用表单上传程序插件上传照片 http://jquery.malsup.com/
I'm using the form uploader plugin at this site to upload photos http://jquery.malsup.com/
它真的很好,我对此感到满意.
It works really well and I'm happy with it.
唯一的陷阱是我在附加表单时删除了HTML DIV(清除包含Form元素的HTML)时&然后在表单第二次附加的HTML的第二次重新创建上重新创建它(我需要在网站上执行此操作). (例如:在删除元素时不会取消绑定).
The only catch is I when I remove the HTML DIV when the form is attached (clear the HTML including Form element) & then re-create it (I need to do this for the site) on the second re-creation of the HTML the form attaches for a second time. (eg: it doesn't unbind when the element is removed).
我一直试图取消绑定该活动,但似乎无法这样做.
I've been trying to unbind the event but I can't seem to do it.
初始绑定看起来像这样
$('#joinPhotoUploadFormProfile').ajaxForm({
http://jquery.malsup.com/-该插件的网站选项未显示取消绑定.
http://jquery.malsup.com/ - the site options for the plugin doesn't show an unbind.
我已经尝试过类似的事情:
I've tried things like:
$('#joinPhotoUploadFormProfile').children().off();
$('#joinPhotoUploadFormProfile').add("*").off();
$('#joinPhotoUploadFormProfile').ajaxFormUnbind();
$('#joinPhotoUploadFormProfile').unbind('ajaxForm');
有什么建议吗?
下面是我的设置方法:
$('#joinPhotoUploadFormProfile').ajaxForm({
beforeSend: function() {
$('#progressGallery').fadeIn('fast');
var percentVal = '0%';
$('#uploadGalleryBar').width(percentVal);
$('#uploadGalleryPercentage').html(percentVal);
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
$('#uploadGalleryBar').width(percentVal);
$('#uploadGalleryPercentage').html(percentVal).css({'left':'40%','color':'lightblue'});
},
complete: function(xhr) {
我需要关闭委派吗?我该怎么做?
Do I need to turn off delegation? how do I do this?
推荐答案
据此:
$('#joinPhotoUploadFormProfile').ajaxFormUnbind();
应该工作.
只需确保您在删除表单之前调用unbind!
这篇关于jquery.form.js-如何解除此表格的绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!