jQuery Syntax Enhancement
Demonstrates the use of defineProperty to add a setter function to the jQuery prototype.
by acbabis
HTML
<a href="#">Faded Link</a>
JavaScript
$(function(){
Object.defineProperty($.prototype, 'alpha',
{set: function(value) {
this.css('opacity', value);
}});
});
$(function() {
$('a').alpha = .5;
});