Retrieving optgroup label for selected option in a drop down list with Mootools
Just a quick tip for getting the selected option optgroup label using Mootools:
The HTML:
<select id="transport"> <optgroup label="Cars"> <option>Ford</option> <option>BMW</option> <option>Mercedes</option> </optgroup> <optgroup label="Motorbikes"> <option>Honda</option> <option>Yamaha</option> <option>BMW</option> </optgroup> </select>
Mootools JavaScript:
// get optgroup label of selected option on change document.id("transport").addEvent("change",function(){ var optGroup=this.getSelected().getParent("optgroup").get("label"); // do something with the label alert(optGroup); })
Ajax Availability Calendar v3 released
In January 2008 I released for public downloading the first version of my Ajax Availability Calendar.
Over the first few months I continually developed it, fixing bugs and taking into account the suggestions and requests made by the many people who gave feedback on the forum. It finally settled down to a “version 2” state and, due to work commitments, I had to let it lie for a while.
When I initially started on the script the idea was that it was to simply be a calendar to show availability with an AJAX interface to be able to update the calendar date states simply by clicking on them (ie no need to reload the page each time you need to set the availability of the dates). I imagined that it would be implemented on websites by web developers like myself so this script would just become “part” of the integration.
Continue reading »
Mootools Splash Screen
Every now and then you get a client that absolutely insists on having a “splash screen“. However hard you try to convince them that it is not good for SEO (search engines like content and links) or for visitors (after all, you are wasting their time), they refuse to see it your way and insist on having it.
I had one of them this week and, rather than spending the time and energy on trying to persuade the client, I decided to have a go at making one with my favorite javascript Library – Mootools.