You cannot do this with a text box. You have no control over the formatting of only certain parts of the HTML5 placeholder attribute. Not to mention that if you want to get multi-color text, you can no longer use a text box or text box. You will need to use an element with the attribute contenteditable="true" and write your own plugin.
Here, for example, what the markup looks like:
<div contenteditable="true"> Address Line 1 - <span style="color: red">Required</span>; </div>
But since this is a div element, you will need to create a backup with the corresponding hidden field so that the value is sent to the server. Also, when the value of this field changes, you also need to re-synchronize the value of the hidden field. It will be a lot of work.
Darin Dimitrov
source share