An effort to bring a revolution in Salesforce.

Tuesday, 26 July 2016

How can I show/ hide a div when the checkbox is selected?

Here is simple code With javascript.


<apex:page >
 <head>

 </head>
 <apex:form >
  <script>
  function HideMsg(istrue)
  {
    var checkval = document.getElementById("msg")
    if(istrue.checked )
    {  
        var checkval = document.getElementById("msg").style.display='block';
    }
    else
    {
        var checkval = document.getElementById("msg").style.display='none';
    }
  }
  </script>
  <apex:pagemessages />

  <div>
   <apex:inputCheckbox id="checkbox" onchange="HideMsg(this);"/>
  </div>
  <div class="showp" style="display: none" id="msg">
  <p>Hello World</p>
  </div>
 </apex:form>
</apex:page>
,

No comments:

Post a Comment

Get Gmail, Docs, Drive, and Calendar for business