You won't edit the embed code within Marketo, you'll edit it when you add it to your site... so using the example on the link you posted, you'll get the following code from Marketo:
<script src="//app-sjqe.marketo.com/js/forms2/js/forms2.js"></script>
<formid="mktoForm_621"></form>
<script>MktoForms2.loadForm("//app-sjqe.marketo.com", "718-GIV-198", 621);</script>
The customization happens in the last line, where you change it to this:
<script>MktoForms2.loadForm("//app-sjqe.marketo.com", "718-GIV-198", 621, function(form){
//Add an onSuccess handler
form.onSuccess(function(values, followUpUrl){
//get the form's jQuery element and hide it
form.getFormElem().hide();
//return false to prevent the submission handler from taking the lead to the follow up url.
return false;
});
});</script>
So basically if you look at the comments in that code, you can see where you will specify how to hide the form itself. All you would need to do is create a hidden "thank you" block on the page and then un-hide that one as you hide the form.
Does that make sense?