Custom select box upgrade
Thursday, September 30th, 2010 | Author: Matjaž Hladnik
I’ve made a little improvement on my custom select box mootools class.
Custom selectbox now:
- applies the selected element as active and
- fires the change event of it’s select tag.
Use the selected property on the option tag:
<option value="40" selected="selected">fourty</option>
Define onchange event through property:
<select onchange="alert('Ninja!');">
Or add event change through mootools:
$('sel2').addEvent('change', function(){ if(this.value == 70) alert('You hit 70!'); });
See demo here.
Category: Web development
| | Leave a Comment

