<script> var Edit = { save: function(){ console.log( 'ONCLICK!!!' ); } }; </script> <form name="main" onsubmit="return false;"> <button onclick="Edit.save();">Save</button> </form>