Added 'on' method

‘on’ method updates the match media by passing in a callback function.
Yea, the only reason I changed it to javascript is become for some reason html doesn't indent the code.