Phoenix
Phoenix

Reputation: 23

Uncaught TypeError: Cannot call method 'click' of null

I have some scripts on my page that going in conflict.

Firebug gives me this error:

Failed to load 
Uncaught TypeError: Cannot call method 'click' of null

from this script:

<script type="text/javascript" src="jquery-1.2.pack.js"></script>
<script type="text/javascript" src="jquery.jPrintArea.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('.link').click(function(){ $.jPrintArea('#tabella') });   
});
</script>

What is the problem? Many thanks!

ps. sorry for my bad english!

Upvotes: 2

Views: 11087

Answers (2)

Renjith Prince
Renjith Prince

Reputation: 43

It may also happen due to conflicts.

Use this:

var j = jQuery.noConflict();    
j(document).ready(function(){
    j('.link').click(function(){ j.jPrintArea('#tabella') });    
});

Upvotes: 3

SeanCannon
SeanCannon

Reputation: 78006

Replace:

<script type="text/javascript" src="jquery-1.2.pack.js"></script>

With

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>

Always make sure you have the latest version of JQuery before attempting to debug. Odds are heavy this issue was fixed in the core library.

Upvotes: 0

Related Questions