Implementing Element.getSiblings() in mootools1.1

Saturday, June 27, 2009 23:43
Posted in category Joomla, Mootools, javascript

I found a nice mootools code in David Walsh’s Blog. This code gathers all the siblings of an element but this code is compatible with mootools1.2 and above. I have modified the code a little to implement it in mootools1.1. Why mootools 1.1? because Joomla1.5 still uses mootools1.1. (Joomla1.6 will have mootools1.2). So here is the little modification of the code as presented by David Walsh.

Element.extend({
    getSiblings: function() {
        return this.getParent().getChildren().remove(this);
    }
});

Yes, this small code gathers all the siblings of the element except for itself. Isn’t it simple? ;)

VN:F [1.8.3_1051]
Rating: 10.0/10 (1 vote cast)
VN:F [1.8.3_1051]
Rating: 0 (from 0 votes)
Implementing Element.getSiblings() in mootools1.110.0101
http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/digg_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/reddit_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/stumbleupon_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/delicious_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/blogmarks_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/google_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/myspace_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/facebook_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/yahoobuzz_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/twitter_32.png
You can leave a response, or trackback from your own site.

Leave a Reply