Adding DOM methods with Prototype
I just discovered that prototype has a really cool way to add methods to all instances of any tag. Simply call Element.addMethods(tagname, methods)
. For example, here’s how I added a request
method to anchors, which will just make an ajax call for the anchor’s href
:
So now I can go through and hijack links with a specific tag name and just call request()
on them:
This content is open source.
Suggest Improvements.