Dear sir,
I have a drop-down list. I need go to necessary paragraphs in same page by clicking selected item I tried your before direction and snippet but it is not working
Hi rajeesh,
Refer below sample.
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> body { font-family: Arial; font-size: 10pt; } </style> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript"> $(function () { $("#ddlSelected").change(function () { if ($(this).val() != '0') { $('html, body').animate({ 'scrollTop': $('#dv' + $(this).val()).offset().top }, 500); } }); }); </script> </head> <body> <form id="form1" runat="server"> <div> <asp:DropDownList runat="server" ID="ddlSelected"> <asp:ListItem Text="Select" Value="0" /> <asp:ListItem Text="Home" Value="Home" /> <asp:ListItem Text="About" Value="About" /> <asp:ListItem Text="Services" Value="Services" /> <asp:ListItem Text="Gallery" Value="Gallery" /> <asp:ListItem Text="Contact" Value="Contact" /> </asp:DropDownList> <hr /> <div id="dvHome" style="height: 200px"> <h3> Home Content.</h3> </div> <div id="dvAbout" style="height: 200px"> <h3> About us Content.</h3> </div> <div id="dvServices" style="height: 200px"> <h3> Services Content.</h3> </div> <div id="dvGallery" style="height: 200px"> <h3> Gallery Content.</h3> </div> <div id="dvContact" style="height: 200px"> <h3> Contact us Content.</h3> </div> </div> </form> </body> </html>
Screenshot
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.