I need to add an attribute to our Marketo form tags that are hosted on our Wordpress site. Does anyone have experience with doing this? While Marketo Support says it's possible, they can't offer help since it now involvea Wordpress. My developer is telling me he doesn't see where he can edit the HTML of the Marketo form. I'm not finding much in the community in regards to this issue, so any insight would be appreciated!
What is the exact attribute you're looking to add?
You can definitely do this with the Marketo Forms 2 API in JavaScript:
<script src="//[your-app-id].marketo.com/js/forms2/js/forms2.min.js"></script>
<script>
MktoForms2.whenReady(function (form) {
$("form#mktoForm_[your-form-id]").attr( "class", "coolerForm" );
});
</script>
<script>MktoForms2.loadForm("//[your-app-id].marketo.com", "[your-id]", [your-form-id]);</script>
Scripting it is a bit unnecessary. You can edit the markup of your embed code directly, so long as you don't change the id:
<form id="mktoForm_621" yourAttribute="your value"></form>
This is exactly what we were trying to do, and he successfully figured it out. Thank you!