How to disable all buttons on the page while uploading?

隐身守侯 提交于 2020-04-10 08:24:14

问题


I'm using json +jquery on client side. I want to disable all buttons found on the page while uploading file. Currently I'm disabling the upload button only using its id as shown below..

$("#upload_attachment_button").addClass('ui-state-disabled');

I wonder if there is a way to disable the rest of the buttons found on the page. I have done a function that I want to use by all the system, and I don't want to send the buttons id every time I want to call this function..

Thanks.


回答1:


It's rather simple. Select all the input elements of the form with type button and disable them:

$("input[type=button]").attr("disabled", "disabled");


来源:https://stackoverflow.com/questions/3822054/how-to-disable-all-buttons-on-the-page-while-uploading

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!