The Classic Builder doesn't set placeholder text on multi-line text fields. This script adds placeholder text to any empty text area on your form.
This is community code, not an official Unbounce feature. Unbounce Support can't troubleshoot custom code. Test it on a published page before relying on it.
Before you start
This script requires jQuery. See Installing jQuery on Your Landing Page.
Add the placeholder text
- Make sure your form includes a multi-line text field.
- In the JavaScripts section, add the following script with placement set to Before Body End Tag:
<script>
$(document).ready(function () {
$('form').find("input[type=textarea], textarea").each(function (ev) {
if (!$(this).val()) {
$(this).attr("placeholder", "Type the placeholder text here!!!");
}
});
});
</script>
- In the script, replace
Type the placeholder text here!!!with your own placeholder text. - Save and republish the page.