Useful little WP JS function for textfields.

When playing around with a custom post type I wanted to add similar behaviour as the title field. You know placeholder text, screen-reader-text class and that. The solution was simple, just call the JavaScript function wp_title hint with the id of your textfield. It is found in the post.js script.

1

2

3

jQuery(document).ready(function($)

wptitlehint('someid');

);