function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sk3501.3915272120779841E12sk3501.3915272120779841E12 

how to disable button in vf page

Hi, I am using an image link inside button like given below, and want do disable button on some event but i am not able to disable this. Please help me if you know this. I need this to disable using jquery.

<<button id="btn1" type="button"><img height="16px" src="/resource/myImg" width="16px"></button>
sandeep sankhlasandeep sankhla
Hi Sk,

You want to disable it or you want to hide it ?

Thanks,
Sandeep
sandeep sankhlasandeep sankhla
Hi Sk,

You can use disabled = " true" attribute to disable this button..
ex: <button disabled = " true"></button>

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thanks,
Sandeep
Salesforce Certified Developer 
sk3501.3915272120779841E12sk3501.3915272120779841E12
Hi sandeep,

I want to disable it using Jquery. And i am using the same disabled="true" but it is not disabling the button which contains an image. But it is only working with button only. I have written my code above. I am explaining it bit more by example: disabled="true" is working for given code 
<button id="btn1" type="button"></button>

But it is not working for below given code: 
<button id="btn1" type="button"><img height="16px" src="/resource/myImg" width="16px"></button>

If you have some idea then let me know.
sandeep sankhlasandeep sankhla
Hi Sk,

Can you share your jquery code which you are using to disable it ?

Thanks
Sandeep
sk3501.3915272120779841E12sk3501.3915272120779841E12
j$("#btn1").attr("disabled","true");
sandeep sankhlasandeep sankhla
Hi sk,

You can put alert and check first, if you are getting the dome element then we can check why it is not working..but first check with alert if you are getting the element or not..

thanks
sandeep