Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
show below jquery code
JavaScript
$(document).ready(function () {
                    $('#prvnote').hide();
      $('#regclass').click(function () {
                     $('#prvnote').toggle(400);
                     $('#newdiv').toggle(400);

   });
 });

show below HTML code This div only use as menu

<div id="regclass"><span>View Previous Note</span></div>


Now when i clicked on above div content then below div will display and above span tag content replace with "Post Note"

HTML
<div id="newdiv"><form>......</form></div>
    <div id="prvnote"><form>......</form></div>


When div(newdiv) show then span content "Post Note" and when div(prvnote) show then span content must be "View Previous Note"
Posted

1 solution

Hi Parth Akhbari,
Here is your working solution:

XML
<head runat="server">
    <title></title>
    <script src="js/jquery-1.8.2.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#prvnote').hide();
            $('#regclass').click(ShowHideDivs);
        });

        function ShowHideDivs() {
            if ($('#prvnote').css('display') == 'block') {
                $('#prvnote').hide();
                $('#newdiv').show();
                $('#regclass span').text('Post Note');

            }
            else {
                $('#prvnote').show();
                $('#newdiv').hide();
                $('#regclass span').text('View Previous Note');
            }
        }
 </script>
</head>
<body>
<div id="regclass"><span>Post Note</span></div>
   <div id="newdiv"><form>NEW DIV SHOWN</form></div>
    <div id="prvnote"><form>PREV NOTE DIV SHOWN</form></div>
</body>
</html>
 
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