1

When a user hovers on the element in the table, he should see the message for that element. The message is stored as a property in the model.
This is what I have done so far:

<table>
<tr>
<td data-toggle="tooltip" data-placement="right" title=@item.Message>Message</td>
</tr>
</table>

The message is getting displayed inside the tooltip if its just a few characters, but a really long message is not getting displayed.Any idea what should I do?

Sumedha Vangury
  • 643
  • 2
  • 17
  • 43

1 Answers1

2

Even though there is a limitation in the number of characters for the title attribute in some browsers, it should not affect because you are using the bootstrap tooltip. It should work for long text.

The only problem i can see with your code is, you are not wrapping the text inside single quotes or double quotes. So let's say your item.Message has a value which like "FirstWord and SecondWord", your markup is going to be

<td data-toggle="tooltip" data-placement="right" 
                                           title=FirstWord and SecondWord>Message</td>

So it is going to show only FirstWord because there is a space after that.

You should wrap the value of title attribute in quotes and it will work fine.

<td data-toggle="tooltip" data-placement="right" title="@item.Message">Message</td>
Shyju
  • 214,206
  • 104
  • 411
  • 497