Click here to Skip to main content
15,885,998 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
<script type="text/javascript">
function toggle_visibility(cl){
var els = document.getElementsByClassName(cl);
for(var i=0; i<els.length;> var s = els[i].style;
s.display = s.display==='none' ? 'block' : 'none';
};
}

</script>
Posted

1 solution

XML
<script type="text/javascript">

    $(document).ready(function () {

        $('#divInvisibleContent2').hide();

        $("#btndisplay").live("click", function () {
            $('#divInvisibleContent').css({ "display": "block" });
            $(this).hide();
        });

        $("#btndisplay2").live("click", function () {
            $('#divInvisibleContent2').show();
            $(this).hide();
        });

    });
</script>




Html Content should be :


XML
<body>
    <input id="btndisplay" type="button" value="click On Me" />
    <div id ="divInvisibleContent" style="display:none">
        <span>Hello how are you ?</span>
    </div>


    <input id="btndisplay2" type="button" value="click On Me Again" />
    <div id ="divInvisibleContent2">
        <span>Hello how are you Again ?</span>
    </div>

    </body>
</html>




I have added 2 buttons with related divs and handled with different approach . . i think this will be helpful for you..


Thank
Bimal
 
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