Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML character code to underline next character

Tags:

html

underline

Like:

abcdef 
 _

What HTML character code I need to insert before b to make b underlined?

I need this inside a html attribute (value of a input field), so html tags like <u> are not acceptable


example:

<input type="submit" value="UnderlineMeifUknowHow" accesskey="n" />

I want the first "n" from UnderlineMeifUknowHow to be underlined

like image 955
Alex Avatar asked Jan 03 '12 23:01

Alex


1 Answers

You can simply put &#818; after any word and it becomes underlined, its a HTML Code.

<input type=button value=S&#818;end>

It becomes:

S̲end

But you can create a JavaScript function to do it for you, see:

function underlineWord(pos,str){
  str = str.substring(0,pos) + str[pos] + "&#818;" + str.substring(pos+1,str.length);
  return str;
}

This way, if you execute:

underlineWord(0,"string");

You will have:

s̲tring

like image 108
Paulo Roberto Rosa Avatar answered Nov 13 '22 04:11

Paulo Roberto Rosa