Behaviour - Clean up your HTML code!

April 1st, 2006

The missing link in your ajax apps. This is what the writer of this scripts says, and it seems like it’s one cool tool. Check it out, it will help you associate events with elements based on CSS and no chunky javascript in the middle of your HTML:
http://bennolan.com/behaviour/

Example of usage:

<ul id="example">
	<li>
		<a href="/someurl">Click me to delete me</a>
	</li>
</ul>

And then use css selectors to select that <a> element and add javascript functions to it.

var myrules = {
	'#example li‘ : function(el){
		el.onclick = function(){
			this.parentNode.removeChild(this);

		}
	}
};

Behaviour.register(myrules);

JavaScript, CSS, XMLHttp/Ajax | Comments | Trackback Jump to the top of this page

Comments are closed.

Just Organizing My Head

Meta