IE: jQuery and Prototype conflict
Hi,
For some reason, my page has to use both prototype and jquery. However, there is a weird problem about getting width and height of an element using jQuery.
Here is my test page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Conflict</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script>var $j = $.noConflict();</script>
<script type="text/javascript" src="http://prototypejs.org/assets/2009/8/31/prototype.js"></script>
</head>
<body>
<img id="thumb" src="http://img190.imageshack.us/img190/9420/1156473.jpg" alt = "" />
<script>
$j(window).load(function(){
alert($j("#thumb").width() + " " + $j("#thumb").height());
});
</script>
</body>
</html>
Running in Firefox, it shows "110 110", which is correct. However, running in IE (IE8), it shows "886 478". I don't know where that value comes from.
Please help!!!