Click here to Skip to main content
15,923,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii,
I want to set visibility of my div elements to false , but i dont wan to set id on it , I have given class name to Div element. So i want to set according to class name of that div elemnt
Posted

 
Share this answer
 
You can do using jQuery. I have three steps

1. create two div one has css class and another does not have

XML
<div class="myClass">
        It is hidden div
    </div>
    <div>
        It is visble div
    </div>


2. Add reference of jQuery library

JavaScript
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>


3. Create your function where you hide a div. I am going to hide div on first time page/document loads.

JavaScript
<script type ="text/javascript">
          $(document).ready(function () {
              $(".myClass").css("display", "none");
          });
      </script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900