0

I need tool-tip in capitalize like "Mr Raj Patel". I am using title for tool-tip but its comes as I Save in database.

Html Code :

<td class='td_3'><div class='oneline' style='width:"100px !important;text-transform: capitalize;' title='" + item.ClassTeacher + "'> item.ClassTeacher.ToLower() </div></td>

item.ClassTeacher is taken Value like I show above "Mr Raj Patel" but in Tool-tip it not comes in capitalize.

also given Screen-shot of tool-tip

Toot-tip imageThank you..

Herry
  • 77
  • 1
  • 12

1 Answers1

1

CSS text-transform: capitalize; will not affect the title attribute (see Can CSS uppercase the text shown for the title atribute)

Solution suggested by Alex using Javascript:

var elem = document.getElementById('divId');
elem.title = elem.title.toUpperCase();

Or captilize item.ClassTeacher using C# in the Controller or Razor View:

string capitalized = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(item.ClassTeacher);
Community
  • 1
  • 1
Georg Patscheider
  • 9,357
  • 1
  • 26
  • 36