0

im beginner in jquery, i need to horizontal accordion menu by using jquery, i found couple of code but i cant use them within master page and content page in asp.net 4.0. how can i define jquery method in asp.net masterpage and content page....here is the jquery sample i wanna use in my page...

contentpage header

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link href="slidemenu.css" rel="stylesheet" type="text/css" />
<script src="slidemenu.js" type="text/javascript"></script>

endcontent header

maincontent

<script type="text/javascript">
    $('#MainContent').load(Function(){
    slideMenu.build('sm',200,10,10,1);
    });
</script>

here is ul and li tags withi

endmaincontent

serim urhan
  • 139
  • 2
  • 10
  • 21

2 Answers2

1

To ensure that the DOM hierarchy is fully constructed and the #MainContent element exists, call the required jQuery script within the $(document).ready function:

<script type="text/javascript">
$(document).ready(function() {
    $('#MainContent').load(Function(){
        slideMenu.build('sm',200,10,10,1);
    });
});
</script>

.ready() - jQuery API

Mikhail
  • 9,186
  • 4
  • 33
  • 49
  • my guess is having the JS in the head and not using an on dom ready call is the problem, so Mikhail's solution is correct. Moving the slidemenu JS to the bottom of the body tag should also work and improve the page load due to the browser not blocking on the JS file – MJJames Feb 26 '11 at 18:28
0

try moving the script tag into your content page.

Ryan
  • 119
  • 3
  • all tags already content page there is nothing in masterpage, contentheader maincontent , this can be problem.. – serim urhan Feb 26 '11 at 16:47