+ Start a Discussion
PS81PS81 

Jquery Ready function - diable textarea referencing sobj

Hi

I have a textarea which i'm trying to disable using the below code via JQuery read function
jQuery( document ).ready( function(){
jQuery( 'input[id$=oprm12]' ).prop('disabled', true);   //Works for text field
jQuery( 'input[id$=oprprob]' ).prop('disabled', true);  //Does not works for text area
 }


The function works for text field but not for textarea field. the id 'oprprob' refers to an input field of type textarea in opportunity. Any inputs on how to fix this please?
PS81PS81
here is the simpler version of my page:
 
<apex:page standardController="Opportunity">
<apex:includescript value="{!URLFOR($Resource.jquery, 'js/jquery-1.11.3.js')}" /> 
<apex:form >
<apex:inputTextarea value="{!Opportunity.Project_Code__c}" id="oprpcd" style="width:250px"/> 
</apex:form> 
<script> 
$( document ).ready( function(){ 
document.getElementById('{!$Component.oprpcd}').disabled = 'disabled';
}); 
</script> 
</apex:page>

 
Pramodh KumarPramodh Kumar
Hi,

Please use this code and let me know if you have any issues
<apex:page standardController="Account">
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" />
    <apex:form >
        <apex:inputTextarea value="{!Account.Disable__c}" id="oprpcd" style="width:250px"/> 
    </apex:form> 
    <script> 
    $( document ).ready( function(){
        //debugger;
        $('[id$="oprpcd"]').prop("disabled", true);
    }); 
    </script> 
</apex:page>

Thanks,
pRAMODH.