Is there a simple way of getting placeholder text on the forms rather than labels. I tried hiding field labels but this didn't work any ideas. SS3.1
Steve
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Is there a simple way of getting placeholder text on the forms rather than labels. I tried hiding field labels but this didn't work any ideas. SS3.1
Steve
You can use this jQuery segment with form id or extra class for the form
$("#idOrclass :input").each(function(index, elem) {
var eId = $(elem).attr("id");
var label = null;
if (eId && (label = $(elem).parents("form").find("label[for="+eId+"]")).length == 1) {
$(elem).attr("placeholder", $(label).html());
$(label).remove();
}
});