Reputation: 1529
I'm learning JQuery plugin and stared to create a simple plugin using below but it's not working. Please tell me what's going wrong with this. What this plugin will do is it just displays the id of the mentioned DOM element.
<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>
Upvotes: 0
Views: 133
Reputation: 630409
JQuery
should be jQuery
, it's case-sensitive.
You can test your code with only that fix here.
Upvotes: 1