asp.net - jQuery stop tooltip plugin displaying html -
i tooltip stop displaying rendered html , mark instead. noticed displaying data in i.e. repeater following works fine. using jquery tooltip plugin 1.3.
server.htmlencode(eval("activitydescription") string)
and thought same title attribute
<td class="activitydescriptiontooltip" title="<%# server.htmlencode(eval("activitydescription") string) %>"> <%# utilities.truncateatword(server.htmlencode(eval("activitydescription") string),30) %> </td>
tooltip called via plugin
$j('.activitydescriptiontooltip').tooltip();
so if acticvitydescription "<h2>test</h2>"
i want see "<h2>test</h2>"
in tooltip. title attribute renders as
title="&lt;h2&gt;test&lt;/h2&gt;"
but in tooltip renders "test" h2 formatting.
is possible ?
yes, not possible, should work same in "repeater".
the function used (server.htmlencode) perfect this.
the following should work fine
<td class="activitydescriptiontooltip" title="<%# server.htmlencode("<h2>test</h2>") %>">
the problem code encode string twice (therefore tooltip show encoded string).
instead of this:
<td class="activitydescriptiontooltip" title="<%# server.htmlencode(server.htmlencode(eval("activitydescription") string)) %>">
try this:
<td class="activitydescriptiontooltip" title="<%# server.htmlencode(eval("activitydescription") string) %>">
edit:
you stated not work. think does.
check out this fiddle. can see html is:
<div title="<h2>test</h2>">asdf</div>
and if hover on div in down-right (result) frame, tooltip shows <h2>test</h2>
fine. in ie10, ff , chrome @ least. (i haven't tried other browsers, stunned if worked differently in matter).
edit2:
the jquery tooltip plugin old , outdated plugin, require 1 level of encoding:
check this fiddle
<div title="&lt;i&gt;test&lt;/i&gt;">asdf</div>
it encoded twice , shows fine.
on other hand not recommend plugin. jquery ui tooltip better choice you.
Comments
Post a Comment