1

I am trying to make a placeholder text in an input field, but having a hard time making this work. I tried within the js of the capture for document.getElementsByName("toEmail")[0].placeholder = "Email*"; but it doesn't get set. Any ideas?

1

Try inserting the following before the closing </form> tag when editing the Smart Capture block's HTML:

<script>
var formInputToEmail = document.getElementsByName('toEmail');
var placeholderToEmail = document.createAttribute('placeholder');
placeholderToEmail.value = 'Email*';
formInputToEmail[0].setAttributeNode(placeholderToEmail);
</script>

The above code snippet assumes the following:

  • The name attribute value of your input field is exactly "toEmail" (JavaScript is case-sensitive)
  • "toEmail" is unique (i.e., no other input fields have this attribute value for name)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.