Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 23, 2010 12:29 AM by malcolms
Member
135 Points
157 Posts
Jan 21, 2010 10:27 PM|LINK
Hello
I have a call $(document).ready() and in page (I should do it). But I get js-error in this case. How to solve it?
All-Star
82577 Points
15430 Posts
MVP
Jan 21, 2010 11:31 PM|LINK
Post your code. No one here is a magician and can solve a problem like that.
NC...
Jan 22, 2010 12:23 AM|LINK
*.master
$(function(){ $(".myMenu").buildMenu( { template:"menuVoices.html", additionalData:"pippo=1", menuWidth:200, openOnRight:false, menuSelector: ".menuContainer", iconPath: "/Scripts/jquery.mb.menu.2.7.2/ico/", hasImages:true, fadeInTime:100, fadeOutTime:300, adjustLeft:2, minZindex:"auto", adjustTop:10, opacity:.95, shadow:true, shadowColor:"#ccc", hoverIntent: 0, openOnClick: false, closeOnMouseOut:true, closeAfter:300 });
one of .aspx:
$().ready(function() { $("#activeFirst").click(function() { $("#container0").tab({ type: "top", navigationClass: "header", contentsClass: "contents", activeClass: "active", closable: true, onClose: function(index) { alert("Close tab " + index) }, onShow: function(index) { alert("Show tab " + index) } }); return false; }); var tab0 = $("#container1").tab({ type: "top", navigationClass: "header", contentsClass: "contents", activeClass: "active", closable: false }); });
another aspx has another $(document).ready() function, but all pages should have js from master page
18687 Points
3124 Posts
Jan 22, 2010 01:05 AM|LINK
What's the error/problem you're getting?
Jan 22, 2010 02:05 PM|LINK
Microsoft JScript runtime error: Object doesn't support this property or method
on
$(function(){ $(".myMenu").buildMenu( {
32835 Points
5563 Posts
Jan 22, 2010 02:54 PM|LINK
The js files reference will not be above the code you are saying it should look like this:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript" src="inc/jquery.metadata.js"></script> <script type="text/javascript" src="inc/mbMenu.js"></script> <script type="text/javascript" src="inc/jquery.hoverIntent.js"></script>
See the view source of:
http://pupunzi.com/mb.components/mb._menu/demo/demo.html
Jan 22, 2010 04:03 PM|LINK
In other words, include the files BEFORE the function call.
Jan 22, 2010 06:52 PM|LINK
again - this is works correctly when aspx does not have $(document).ready() call. And these includes are above then call of code. Problem is if aspx has call $(document).ready() too
Jan 22, 2010 06:58 PM|LINK
Well, I don't think that you can have 2 $(document).ready() calls. Which one should execute? Remove one and try again.
Jan 22, 2010 07:25 PM|LINK
how can I remove one if I need both?
rover83
Member
135 Points
157 Posts
jQuery - 2 calls of $(document).ready()
Jan 21, 2010 10:27 PM|LINK
Hello
I have a call $(document).ready() and in page (I should do it). But I get js-error in this case. How to solve it?
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: jQuery - 2 calls of $(document).ready()
Jan 21, 2010 11:31 PM|LINK
Post your code. No one here is a magician and can solve a problem like that.
NC...
rover83
Member
135 Points
157 Posts
Re: jQuery - 2 calls of $(document).ready()
Jan 22, 2010 12:23 AM|LINK
*.master
$(function(){ $(".myMenu").buildMenu( { template:"menuVoices.html", additionalData:"pippo=1", menuWidth:200, openOnRight:false, menuSelector: ".menuContainer", iconPath: "/Scripts/jquery.mb.menu.2.7.2/ico/", hasImages:true, fadeInTime:100, fadeOutTime:300, adjustLeft:2, minZindex:"auto", adjustTop:10, opacity:.95, shadow:true, shadowColor:"#ccc", hoverIntent: 0, openOnClick: false, closeOnMouseOut:true, closeAfter:300 });one of .aspx:
$().ready(function() { $("#activeFirst").click(function() { $("#container0").tab({ type: "top", navigationClass: "header", contentsClass: "contents", activeClass: "active", closable: true, onClose: function(index) { alert("Close tab " + index) }, onShow: function(index) { alert("Show tab " + index) } }); return false; }); var tab0 = $("#container1").tab({ type: "top", navigationClass: "header", contentsClass: "contents", activeClass: "active", closable: false }); });another aspx has another $(document).ready() function, but all pages should have js from master page
malcolms
All-Star
18687 Points
3124 Posts
MVP
Re: jQuery - 2 calls of $(document).ready()
Jan 22, 2010 01:05 AM|LINK
What's the error/problem you're getting?
rover83
Member
135 Points
157 Posts
Re: jQuery - 2 calls of $(document).ready()
Jan 22, 2010 02:05 PM|LINK
on
$(function(){
$(".myMenu").buildMenu(
{
raghav_khung...
All-Star
32835 Points
5563 Posts
MVP
Re: jQuery - 2 calls of $(document).ready()
Jan 22, 2010 02:54 PM|LINK
The js files reference will not be above the code you are saying it should look like this:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="inc/jquery.metadata.js"></script>
<script type="text/javascript" src="inc/mbMenu.js"></script>
<script type="text/javascript" src="inc/jquery.hoverIntent.js"></script>
See the view source of:
http://pupunzi.com/mb.components/mb._menu/demo/demo.html
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: jQuery - 2 calls of $(document).ready()
Jan 22, 2010 04:03 PM|LINK
In other words, include the files BEFORE the function call.
NC...
rover83
Member
135 Points
157 Posts
Re: jQuery - 2 calls of $(document).ready()
Jan 22, 2010 06:52 PM|LINK
again - this is works correctly when aspx does not have $(document).ready() call. And these includes are above then call of code. Problem is if aspx has call $(document).ready() too
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: jQuery - 2 calls of $(document).ready()
Jan 22, 2010 06:58 PM|LINK
Well, I don't think that you can have 2 $(document).ready() calls. Which one should execute? Remove one and try again.
NC...
rover83
Member
135 Points
157 Posts
Re: jQuery - 2 calls of $(document).ready()
Jan 22, 2010 07:25 PM|LINK
how can I remove one if I need both?