How is it possible to create a plugin using this code as an example:
html:
<div id="instance1">
<a href="#">Click</a>
<b>Change me</b>
</div>
js:
$("#instance1 a").click(function(){
$("#instance1 b").text('Changed');
return false;
});
I would want the initialization to be something like this:
$("#instance1").newPlugin();
Which binds the instance1 id to the click function, how would i update the Javascript code above.. Currently it selects first #instance1, but how does this change based on binding a new plugin?
Something like this: