use jquery accordion on ASP.NET

i try to use accordion to display 2 (p / panels / div)
1st p : 2 textboxes 1 button
2nd p : 3 textboxes 1 button

with the article :
http://www.webdesignerwall.com/tutorials/jquery-tutorials-for-designers/
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
     <script type='text/javascript'
src='script/jquery.js'>
</script>
    
    <script type="text/javascript">
    
      function pageLoad() {
      }
    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <script type="text/javascript">
        $(document).ready(function() {

            $(".accordion2 h3").eq(2).addClass("active");
            $(".accordion2 p").eq(2).show();

            $(".accordion2 h3").click(function() {
                $(this).next("p").slideToggle("slow")
	  .siblings("p:visible").slideUp("slow");
                $(this).toggleClass("active");
                $(this).siblings("h3").removeClass("active");
            });

        });
    
    
    </script>
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div class="accordion2">
        <p>
            sadasdasdasdas
        </p>
        </div>
    </div>
    </form>
</body>

Open in new window

LVL 1
doramail05Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

muhammadyasirCommented:
first remove this <asp:ScriptManager ID="ScriptManager1" runat="server" />
0
doramail05Author Commented:
removed.
0
Steve KrileCommented:
Here is a very simple setup that is essentially the functionality you are looking for.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://code.jquery.com/jquery-1.4.2.min.js" language="javascript"></script>

<style>
	.accordion {}
	.accordion h3 {cursor:pointer;}
	.content {display:none;border:solid 1px;}
</style>
</head>

    <script type="text/javascript">
        $(document).ready(function() {
			//find any h3 tag inside an object with the class accordion
			$(".accordion h3").click(function(){
				//slide up or down the very next item after the h3 tag (in our case, a div)
				$(this).next().slideToggle();
			});

        });


    </script>
<body>

    <div>
        <div class="accordion">
        	<h3>This is an Accordion</h3>
        	<div class="content">
        		Hi there.  I am content.<br/><br/><br/><br/><br/>
        	</div>
        </div>
    </div>
</body>




</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

doramail05Author Commented:
i see, it works like a drill down,

adding one h3 is equivalent to one accordion, and adding another accordion h2 will be larger font will similar function.
0
Steve KrileCommented:
The div tags, and h3 tags are just normal HTML elements.  Webuse jquery to add animation to these elements in various ways.  The code I attached uses jquery to "find" (or in jquery terminology, "select") any h3 tag, then bind a "click" event to the h3 tag.  Once that is done, inside the click event we describe what we want to happen when a user clucks.  In this case we use jquery's built-in animation to slide a div tag section.
0
doramail05Author Commented:
if we would like to add another accordion,
0
Steve KrileCommented:
Ahh, that is the real beauty of jquery.  Just copy and paste the div section with the class=accordion directly below the first one.  Now you will have two.  You don't need to change the code in the script tag.
0
doramail05Author Commented:
ok, since it is something similar to article, i give points bit less than full, ok?.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.