web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Dynamic Placeholder for Marketing form fields

(0) ShareShare
ReportReport
Posted on by 15

Hello,

I would like to ask if anyone has customized their Marketing form fields in a way that the placeholder becomes a field label positioned directly in-between the border of the form field once contact starts to type in their data and if yes, if you could share the code snippet via which you have been able to achieve this?

Thank you very much for your time and answer in advance.

All the best,

Marianna

I have the same question (0)
  • Verified answer
    Haig Liu Profile Picture
    Microsoft Employee on at

    Hi mariannakoz,

    Please add this JS code to the marketing page:

    <script>
            
    MsCrmMkt.MsCrmFormLoader.on("afterFormLoad", function(event) {
    var input = document.getElementById("7f685ebb-7c54-4cff-a1bc-772562d25c38");
    console.log(input);
    var placeholder = document.getElementById('7f685ebb-7c54-4cff-a1bc-772562d25c38').placeholder;
    console.log(placeholder);
    input.addEventListener("blur", function(){
    input.parentNode.children[0].innerHTML = placeholder;
    console.log(input.parentNode.children[0]);
    })
    })

    </script>
    I use the Email field as an example. If you want to apply it to another field, please change the ID in the code to another field

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 72 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 29 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans