O'Reilly logo

MooTools 1.3 Cookbook by Jay Larry G. Johnston

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Moving an element with a particular ID

Once an element is under our beck and call, we can send it somewhere else on the page.

How to do it...

In our HTML sketch, we are pretending to vote for the greater of two, very influential people. Each influence is represented by an element on the page with a unique ID attribute. Moving elements around when we know their unique ID attribute value is simple with the MooTool infused Element::inject() method.

<script type="text/javascript" src="mootools-1.3.0.js"></script> </head> <body> <form action="javascript:" method="get"> Choose the greatest influence of the Internet:<br/> <select id="influence"> <option value="">Vote Now:</option> <option value="bill">Bill</option> <option value="linus">Linus</option> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required