What I'd like to do is add input prompts to text fields on a Sharepoint 2013 form.

There's a fairly nice solution here, and it does the mechanics nicely. What it shows for a prompt, however, is the underlying textarea title, which is rendered as the field's NAME. Unfortunately, the SharePoint:FormField control doesn't expose the title attribute.

If I could get it to render the field's DESCRIPTION instead, I'd have exactly what I want.

Does anyone here know how to do this?


1 Answer 1


Try this

    jQuery(this).addClass('input-prompt-' + i);
    var promptSpan = jQuery('<span class="input-prompt"/>');
    jQuery(promptSpan).attr('id', 'input-prompt-' + i);     
        jQuery('.' + jQuery(this).attr('id')).focus();
    if(jQuery(this).val() != ''){
        jQuery('#input-prompt-' + i).hide();
        if(jQuery(this).val() == ''){
            jQuery('#input-prompt-' + i).show();
  • Amal, you're rehashing the Kyle Schaeffer code I'm already using (see "here" above). The prompt appears and disappears appropriately, but it uses the NAME of the field rather than its DESCRIPTION
    – Josh Korn
    Dec 4, 2014 at 19:46
  • Yes. I modified the code so now it pull description instead. Dec 4, 2014 at 19:46
  • It doesn't work. The expression <b>$(this).parent().next().html()</b> is undefined. And looking at the generated markup, the code would have to come from the server - how else could it pick up the description field (which isn't otherwise rendered)?
    – Josh Korn
    Dec 4, 2014 at 21:03
  • In 2013 description is placed below the input controls Dec 4, 2014 at 21:32
  • Only on out-of-box edit forms.
    – Josh Korn
    Dec 5, 2014 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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