<apex:commandButton value="Default View" action="{!showlist}" styleClass="input" id="hide1"  disabled="true"/>
<apex:commandButton value="Quote List" action="{!view}" styleClass="input" onclick="show()"/>

function show(){

after clicking the quote list .it has either remove the attribute or change the attribute value to false.i had tried several jquery and javascript any body can help in this


3 Answers 3


Have a look, it may help you:

    function show(){
        document.getElementById('hide1').className = "btn input";
    function callView() {
        var callBtn= document.getElementById('hide1').className ;

        if(callBtn == 'btn input'){
            console.log('m clicking..');

</script >
<apex:form id="form1">
    <input type="button" value="Default View" class="btn btnDisabled" id="hide1" onclick="callView();"/>
    <input type="button" value="Quote List"  class="btn" id="testt" onclick="show()"/>
    <apex:actionFunction name="showlist" action="{!showlist}" rerender="out">
    <apex:actionFunction name="view" action="{!view}" rerender="out">

  • I think you have forgot action="{!view}
    – D-Horse
    Commented Mar 12, 2014 at 13:31

If you have included jquery file then try this:

$("[id$='hide1']").prop("disabled", false);
$("[id$='hide1']").prop("disabled", true);
  • 1
    Can you provide me your req. so I can help you.
    – D-Horse
    Commented Mar 12, 2014 at 12:49
  • Hmmm, why can't you just rerender page? Commented Mar 12, 2014 at 12:55
  • To achieve the functionality you need a property. This property should be set true and applied on two buttons which you want to be disable eg disabled="{!property}". When User click on third button then in your function you need to change the property value true to false and rerender the parent section where you have another two buttons
    – D-Horse
    Commented Mar 12, 2014 at 12:58

I use sometimes this when is in JQuery and I would like to disable it:

$j('#hide1').attr("disabled", true);

I use sometimes css to don't display:


or even this one

var saveID ="{!$Component.myform.savebutton}";
var save = document.getElementById(saveID);
save.style.display = "none";

Hope it helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .