如何使用 jQuery Multifile 禁用元素?
此代码没有按预期禁用我的元素
if(Multifile.n==0){
$("#btnUpload").attr("disabled","disabled");
}
此代码没有按预期启用我的元素
$("#btnUpload").attr("disabled","");
我在 jQuery.MultiFile.js 中添加了这些行,位于我认为是的位置之后在 MultiFile 对象中添加和删除文件。据我所知, MultiFile.n 是一个计数器。
如何在列表中没有文件的情况下禁用btnUpload,并在至少有一个的情况下启用它。
This code does not disable my element as expected
if(Multifile.n==0){
$("#btnUpload").attr("disabled","disabled");
}
This code does not enable my element as expected
$("#btnUpload").attr("disabled","");
I added these lines in jQuery.MultiFile.js after what I believe is the location where files are added and removed from the MultiFile object. As far as I can tell, MultiFile.n
is a counter.
How can I disable btnUpload when there are no files in the list, and enable it as long as there is at least one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果元素上有一个禁用属性,那么即使该属性为空,它也将始终被禁用。这是因为原始(SGML 变体)HTML 的属性没有这样的值,
因此您必须删除该属性
If there is a disabled attribute on the element, it will always be disabled, even if the attribute is empty. This is because the original (SGML variant of) HTML had attributes without values like this
So you have to remove the attribute