7

I am trying to use jGrowl in ASP.NET, but am getting a Microsoft JScript runtime error: Object doesn't support this property or method error when trying to run the page in IE. Any ideas why this is happening?

<link rel="stylesheet" href="css/jquery.jgrowl.css" type="text/css" />
<style type="text/css">
div.jGrowl div.smoke {
background: url(images/smoke.png) no-repeat;
-moz-border-radius:  0px;
-webkit-border-radius: 0px;
width:      280px;
height:     55px;
overflow:     hidden;
}
</style>
<!--[if lt IE 7]>
<link rel="stylesheet" href="css/jquery.jgrowl.ie6.css" type="text/css" />
<![endif]-->

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.jgrowl.js"></script>
<script type="text/javascript" src="js/jquery.template.js"></script>
<script type="text/javascript" src="js/jquery.ui.all.js"></script>
<script type="text/javascript" src="js/jquery-1.4.2.js" ></script>
<script type="text/javascript">

    $(document).ready(function(){

    $('#test2').jGrowl("TEST", {
        theme: 'smoke',
        closer: true
    });

});

</script>

BODY:

<a onclick="$('#test2').jGrowl('TEST');" href="javascript:void(0);">Sample 3</a>

3 Answers 3

14

I think you are including jquery twice. You have a jquery.js and jquery-1.4.2.js script files included. Everything seems to be plugging into the first instance and then the last include overrides $. So that's why you're seeing this error message.

Sign up to request clarification or add additional context in comments.

2 Comments

That fixed the error, thanks. One question though, for some reason the jGrowl window is displayed both when the page is loaded and is also activated when the link is clicked. Do you know why that is happening?
@MiziaQ, it is because you are doing a jGrowl call in the $(document).ready handler. What you probably want to do is remove the oncick handler on the tag and do the following in document.ready $('#test').click(function(e) { $(this).jGrowl("TEST"); e.preventDefault(); });
3

Including 2 jquery files of the same type generates this type of errors. Get rid of one of them and your problem is solved.

//<script type="text/javascript" src="js/jquery.js"></script>   
<script type="text/javascript" src="js/jquery.jgrowl.js"></script>  
<script type="text/javascript" src="js/jquery.template.js"></script>  
<script type="text/javascript" src="js/jquery.ui.all.js"></script>  
<script type="text/javascript" src="js/jquery-1.4.2.js" ></script>   

Comments

0

May be you haven't posted your complete page source but if you have this line in addition to other JQuery/JavaScript includes, try removing it from the page.

<script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.