Add onChange function to an existing checkbox

Introduction

If you can not change the file which renders the checkbox, you can use the following solution.

Solution

document.getElementsByName('addressChange')[0].addEventListener(
                          'change',
                          function() {  alert('test'); },
                          false
                        );