Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the sqrt symbol in a buttons value?

im trying to get the sqrt symbol to display inside my button. I cant seem to get it to work. Here is my button code

<input type="button" id="sqrt" value="sqrt" onclick="insert function here">

We the value, i need to get the sqrt symbol to show up and I cant seem to figure out how.

like image 755
WilsonKoder111 Avatar asked Dec 25 '22 08:12

WilsonKoder111


2 Answers

If you need to find a specific symbol you can refer to W3's Character Entity Reference Chart.

The Square Root (√) symbol can be displayed using one of the following:

&radic;
&Sqrt;
&#x0221A;
&#8730;

For example:

<input type="button" value="&radic;" />       <!-- or... -->
<input type="button" value="&Sqrt;" />        <!-- or... -->
<input type="button" value="&#x0221A;" />     <!-- or... -->
<input type="button" value="&#8730;" />

Personally I'd opt for either &#x0221A; or &#8730; as these directly reference the symbol's Unicode ID. A browser may not necessarily have any mapping defined for &radic; or &Sqrt;.

JSFiddle demo.

like image 123
James Donnelly Avatar answered Jan 07 '23 02:01

James Donnelly


Use &radic;:

<input class="sqrt-input" type="submit" value="&radic;" />

Change the font if you don't like the default look:

/* If find Verdana pretty good for this and it's available 
on almost every browser. */
.sqrt-input {
    font-family: Verdana; 
}
like image 38
Holt Avatar answered Jan 07 '23 04:01

Holt