简体   繁体   中英

Button click event not called

I want to disable a button, only using javascript.

I have one button on the form. I want to disable that button from javascript. When I try to do this, the button submit click event is not calling.

I used following code on javascript:

document.getElementById('<%=imgSubmit.ClientID%>').disabled = true; 

The button get disabled; but its button click event on server side is not being called.

When I remove this javascript then it is calling the server side click event. What is the issue with disabling the button from javascript??

Well if the button is disabled it is not going to fire the server side event. Try submitting the form from the client side.

document.getElementById('<%=imgSubmit.ClientID%>').disabled = true; 
Form1.submit();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM