Skip to main content
added 582 characters in body
Source Link
Eric
  • 54.4k
  • 11
  • 104
  • 196

Use .text() instead of .val(). It is not an input it should be a div or td

For the edit button use the "ends with" selector and disabled should be disabled for a value not true:

j$('[id$=edit]').attr('disabled','disabled');

or try

j$('[id$=edit]').prop("disabled",true);

Example Using Account that works

<apex:page standardController="Account" cache="false">

    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"/>


<script>

    $(document).ready( function(){
        $('[id$=testbtn]').prop('disabled',true);
    });

</script>

<apex:form >

    <apex:commandButton id="testbtn" onclick="alert('opps'); return false;" value="Try Me" rerender=""/>


</apex:form>



</apex:page>

Use .text() instead of .val(). It is not an input it should be a div or td

For the edit button use the "ends with" selector and disabled should be disabled for a value not true:

j$('[id$=edit]').attr('disabled','disabled');

or try

j$('[id$=edit]').prop("disabled",true);

Use .text() instead of .val(). It is not an input it should be a div or td

For the edit button use the "ends with" selector and disabled should be disabled for a value not true:

j$('[id$=edit]').attr('disabled','disabled');

or try

j$('[id$=edit]').prop("disabled",true);

Example Using Account that works

<apex:page standardController="Account" cache="false">

    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"/>


<script>

    $(document).ready( function(){
        $('[id$=testbtn]').prop('disabled',true);
    });

</script>

<apex:form >

    <apex:commandButton id="testbtn" onclick="alert('opps'); return false;" value="Try Me" rerender=""/>


</apex:form>



</apex:page>
Source Link
Eric
  • 54.4k
  • 11
  • 104
  • 196

Use .text() instead of .val(). It is not an input it should be a div or td

For the edit button use the "ends with" selector and disabled should be disabled for a value not true:

j$('[id$=edit]').attr('disabled','disabled');

or try

j$('[id$=edit]').prop("disabled",true);