To save space (and keep things more compact) I added a input box with a placeholder stating
<input id="username-search" placeholder="view another users work">
after adding the username, I’d like to change the text of the placeholder to something like
<input id="username-search" placeholder="viewing -theuser-'s work">
as well as remove the text added to the input box by the user, as when text is entered, the placeholder disappears.
Any ideas?
You can change the
placeholderattribute dinamically as you need in anonchangeevent handler for the<input type="text">:JSFiddle.
Take into account that the
<input>‘s value will be cleared afteronchange(), so you might want to keep an<input type='hidden'>with the last inputted value if there’s something you wish to do with it outsideonchange.