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
Uttpal chandraUttpal chandra 

Can't able to write "Select All" label in Checkbox?

Hi All,
I have used wrapper class and I have implemented checkbox but I can't able to write "Select all" beside  the topmost checkbox.

User-added image

Thanks in advance
<apex:page controller="CheckAllUsingJavascriptController">
    <script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");                 
            for(var i=0; i<inputCheckBox.length; i++){         
                    inputCheckBox[i].checked = obj.checked;
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!wrapAccountList}" var="accWrap" id="table" title="All Accounts">
                <apex:column >
                    <apex:facet name="header">
                        <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                    <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
                <apex:column value="{!accWrap.acc.Name}" />
                <apex:column value="{!accWrap.acc.BillingState}" />
                <apex:column value="{!accWrap.acc.Phone}" />

Apex controller

public class CheckAllUsingJavascriptController {
    public List<wrapAccount> wrapAccountList {get; set;}
    public CheckAllUsingJavascriptController(){
        if(wrapAccountList == null) {
            wrapAccountList = new List<wrapAccount>();
            for(Account a: [select Id, Name,BillingState, Website, Phone from Account limit 10]) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapAccountList.add(new wrapAccount(a));
    public class wrapAccount {
        public Account acc {get; set;}
        public Boolean selected {get; set;}
        //This is the contructor method. When we create a new wrapAccount object we pass a Account that is set to the acc property. We also set the selected value to false
        public wrapAccount(Account a) {
            acc = a;
            selected = false;

Uttpal chandraUttpal chandra
Did it i forgot using <apex:output text>
Deepali KulshresthaDeepali Kulshrestha
Hi Uttpal,

Please follow the given below link these links have more example related to select all checkbox after following the below link you can solve your problem, it may be helpful to you.


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
how you solved ..?  Uttpal
Uttpal chandraUttpal chandra

I had used <apex:outputText> inside  <apex:facet> tag.