競合解決複数のJqueryパッケージとその他のフロントエンドjsパッケージの名前競合問題

1026 ワード

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>    1</title>
<!--    prototype  -->
<script src="prototype-1.6.0.3.js" type="text/javascript"></script>
<!--    jQuery  -->
<script src="jquery-1.3.1.js" type="text/javascript"></script>
</head>
<body>
<p id="pp">test---prototype</p>
<p >test---jQuery</p>

<script type="text/javascript">
    jQuery.noConflict(); 			//   $       prototype.js
    jQuery(function() {					//  jQuery
        jQuery("p").click(function() {
            alert(jQuery(this).text());
        });
    });
    $("pp").style.display = 'none'; 	//  prototype

</script>

</body>
</html>