function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
krisstannumkrisstannum 

How to add placeholder in force:inputField?

I need to change the standard place holder in the force:inputField to something else. Is there a way to do this since it is not part of the attributes of this field?

thank you!
Best Answer chosen by krisstannum
sfdcMonkey.comsfdcMonkey.com
hi krisstannum
i also try to do that but there is no way to change the placeholder in force:inputField. its showing default palceholder. if you want to change placeholer then you have need to create custom lookup component for it. because of the locker service enable we also don't have access the DOM elements. by javaScript such as give class name to 'force:inputField' and then on init function set the placeholder document.getElementsByClassName("example").placeholder = 'custom placeholder' but it's also not working with secure framework :{
let me know if it helps you
thanks
[sfdcmonkey.com]

All Answers

sfdcMonkey.comsfdcMonkey.com
hi krisstannum
i also try to do that but there is no way to change the placeholder in force:inputField. its showing default palceholder. if you want to change placeholer then you have need to create custom lookup component for it. because of the locker service enable we also don't have access the DOM elements. by javaScript such as give class name to 'force:inputField' and then on init function set the placeholder document.getElementsByClassName("example").placeholder = 'custom placeholder' but it's also not working with secure framework :{
let me know if it helps you
thanks
[sfdcmonkey.com]
This was selected as the best answer
krisstannumkrisstannum
Thank you for the explanation @piyush_soni