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

Announcements

No record found.

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 120 Super User 2026 Season 1

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 46 Most Valuable Professional

#3
NeerajPawar Profile Picture

NeerajPawar 41

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans