0
私はJQueryプラグインを学習していますが、以下を使用して単純なプラグインを作成していますが、動作しません。これで間違っていることを教えてください。このプラグインは、DOMエレメントのidを表示するだけです。サンプルjQueryプラグインが動作しません
<html>
<head>
<script type="text/javascript" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript">
//creating my first JQuery plugin
JQuery.fn.myfirstplugin = function()
{
// which returns some data
return this.each(function(){
alert(this.id);
});
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
<div id="four"></div>
<div id="five"></div>
<script type="text/javascript">
$('div').myfirstplugin();
</script>
</body>
</html>
うわー。あなたは正しいです。ありがとうニック – JavaGeek
@Sukumar - 歓迎:) –