Я изучаю плагин JQuery и смотрю, как создать простой плагин, используя ниже, но он не работает. Пожалуйста, скажите мне, что с этим не так. Этот плагин будет просто отображать идентификатор упомянутого элемента DOM.
<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>