It's because the saveChanges function scope ( defined in that demo ) is within the closure whereas inline added functions to html are called in global window scope.
So please change this
function saveChanges() {
to this
window.saveChanges = function() {