0

Hi I'm triyng to use subscript characteres into the placeholder of the html input tag.

<input type="text" class="form-control" id="fi2" placeholder="Installed Power kW<sub>p</sub>">

But i got this: Installed Power kW<sub>p</sub>

If I use for example a supercript (sup) everyhing works well...

Any help?

Best regards, Daniel

user3750515
  • 31
  • 2
  • 7

3 Answers3

2

http://www.fileformat.info/info/unicode/char/209a/index.htm

you need some font linked in the webpage that contains subscript p (the fonts are listed on the website cited up), and after, write:

<input type="text" class="form-control" id="fi2">
<script>
    var placeholderText = 'Installed Power kW\u209A';
    $("#fi2").attr('placeholder', placeholderText);
</script> 
1

That's not possible. HTML attributes cannot have HTML markup inside them.

You'd have to use a <label> instead.

And FYI, here's the MDN site says about the use of placeholder:

Do not use the placeholder attribute instead of a element. Their purposes are different: the attribute describes the role of the form element; that is, it indicates what kind of information is expected, the placeholder attribute is a hint about the format the content should take. There are cases in which the placeholder attribute is never displayed to the user, so the form must be understandable without it.

Henrique Barcelos
  • 7,670
  • 1
  • 41
  • 66
1
<input type=“text” class=“form-control” id=“fi2” placeholder=“Installed Power KWₚ”>

I suggest just copy/pasting a subscript char. It sure isn’t a long-term or efficient answer, but it should be adequate for your situation.