Search code examples
htmlbuttonformattingsup

input type button value not formatting HTML properly


I am pulling values from a database which are formatted as so:

147 cm<sup>2</sup>

The aim is to make the 147 cm value squared, but in the button elements it displays as 147 cm<sup>2</sup>

Here is my code, any help would be greatly appreciated:

<div class="catbuttons">
    <% foreach (var ssitem in item.Items) { %>  
        <input type="button" class="BTN-FPC answer floatleft" value='<%: @Html.Raw(ssitem.itemvalue) %>' id='<%:ssitem.itemid %>' name='answer' />
    <% } %>
</div>

An interested point is it works when the values aren't being inserted into button elements as such:

<div>
    <% foreach (var ssitem in item.Items) { %>
        <p style="text-align: justify;"><%: @Html.Raw(ssitem.itemvalue) %></p>
    <% } %>
</div>

Solution

  • I found a solution in case any one with the same issue happens upon this question:

    You can just paste a superscript 2 from the character map into your database. Simple solution.