/* event listener */ document.getElementsByName("Thing")[0].addEventListener('change', doThing); /* function */ function doThing(){ alert('Horray! Someone wrote "' + this.value + '"!'); }