Title: Placeholder text
Last modified: August 21, 2016

---

# Placeholder text

 *  Resolved [navyspitfire](https://wordpress.org/support/users/navyspitfire/)
 * (@navyspitfire)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/placeholder-text-3/)
 * Is there a way to add placeholder text?
 * [https://wordpress.org/plugins/constant-contact-widget/](https://wordpress.org/plugins/constant-contact-widget/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [navyspitfire](https://wordpress.org/support/users/navyspitfire/)
 * (@navyspitfire)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/placeholder-text-3/#post-5022568)
 * Didn’t see that it was there since it’s white.
 *  [Ben](https://wordpress.org/support/users/creatureweb/)
 * (@creatureweb)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/placeholder-text-3/#post-5022863)
 *     ```
       function sf_constantcontact_form($id,$p) {
       	return '<form id="'.$id.'_form" onsubmit="return '.$id.'_submit(this);" class="constantcontactwidget_form">'
       		.(empty($p['txt'])?'':('<p>'.$p['txt'].'</p>'))
       		.'<input type="hidden" name="grp" value="'.esc_attr($p['grp']).'" />'
       		.(empty($p['nam'])
       			?('<input type="text" name="eml" class="input" placeholder="'.__('Email').'"/>')
       			:('<p><label for="fnm">'.__('').'</label> <input type="text" name="fnm" placeholder="First Name" value="" class="input"/></p>'
       			.'<p><label for="lnm">'.__('').'</label> <input type="text" name="lnm" placeholder="Last Name" value="" class="input"/></p>'
       			.'<p><label for="eml">'.__('').'</label> <input type="text" name="eml" placeholder="E-mail" value="" class="input"/></p>'))
       		.(empty($p['req'])?'':('<p><input type="checkbox" name="req" class="input"> '.$p['req'].'</p>'))
       		.'<input type="submit" value="'.esc_attr($p['btn']).'" />'
       		.'</form>'
       		.'<script>function '.$id.'_submit(n){'
       			.'for(var a=n.querySelectorAll("input"),i=0,eml=false,val=["action=constantcontactadd"];i<a.length;i++)if(a[i].name){'
       				.'if(a[i].name=="req"){if(!a[i].checked){alert("'.__('Consent required').'");return false;}}'
       				.'else{if(!(a[i].name!="eml"||!a[i].value))eml=true;val.push(a[i].name+"="+encodeURIComponent(a[i].value));}'
       			.'}'
       			.'if(!eml){alert("'.__('Please enter an email address').'");return false;}'
       			.'var xml=new XMLHttpRequest();'
       			.'xml.open("POST","'.admin_url('admin-ajax.php').'",true);'
       			.'xml.setRequestHeader("Content-type","application/x-www-form-urlencoded");'
       			.'xml.onreadystatechange=function(){if(this.readyState==4){if(this.status==200){if(this.responseText)alert(this.responseText);else '.(preg_match('/^\/\/|^http:\/\/|^https:\/\//i',$p['msg'])?('setTimeout(\'window.location="'.esc_attr($p['msg']).'";\',100);'):('n.innerHTML="'.addslashes($p['msg']).'";')).'}else alert(this.statusText);}};'
       			.'xml.send(val.join(String.fromCharCode(38)));'
       			.'return false;'
       		.'}</script>';
       }
       ```
   
 *  [Ben](https://wordpress.org/support/users/creatureweb/)
 * (@creatureweb)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/placeholder-text-3/#post-5022864)
 * sorry I meant to be more specific. You’ll find the above code on line 94 of constantcontactwidget.
   php.
 * You’ll see how I chose to add placeholders to each field. (might not be the best
   method as far as DOM is concerned and there may be browsers out there that are
   behind on supporting it but it works fine for me.)
 *  [John Antonacci](https://wordpress.org/support/users/johnnya23/)
 * (@johnnya23)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/placeholder-text-3/#post-5022878)
 * you could do this with jquery and be reasonably safe on updates:
 *     ```
       $ccwidget = $( '.widget_sf_widget_constantcontact' );
       $ccwidget.find('label' ).css('display', 'none');
       $ccwidget.find('input[name="fnm"]' ).attr('placeholder', 'First Name');
       $ccwidget.find('input[name="lnm"]' ).attr('placeholder', 'Last Name');
       $ccwidget.find('input[name="eml"]' ).attr('placeholder', 'Email');
       ```
   

Viewing 4 replies - 1 through 4 (of 4 total)

 The topic ‘Placeholder text’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/constant-contact-widget.svg)
 * [Constant Contact Widget](https://wordpress.org/plugins/constant-contact-widget/)
 * [Support Threads](https://wordpress.org/support/plugin/constant-contact-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/constant-contact-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/constant-contact-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/constant-contact-widget/reviews/)

## Tags

 * [input](https://wordpress.org/support/topic-tag/input/)

 * 4 replies
 * 3 participants
 * Last reply from: [John Antonacci](https://wordpress.org/support/users/johnnya23/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/placeholder-text-3/#post-5022878)
 * Status: resolved