5

I want to bind text in span tag but visible=false, and hover on image show span text in tooltip.

<td class="calign"><img src="~/Images/Approval.png" height="15" width="15" alt="" data-bind="tooltip:ApprovalText" /></td>

Tooltip can't display on image hover.

1 Answer 1

15

Bind to the title attribute instead of tooltip (which isn't a valid html attribute):

data-bind="attr:{title:ApprovalText}"
5
  • 1
    Bang on ! but i'm confused why you got a downVote . possible attach a fiddle(jsfiddle.net/LkqTU/26682) which helps the OP .
    – super cool
    Sep 11, 2015 at 13:02
  • 1
    adding a whole fiddle to replace the only data-bind attribute used in their code doesn't add much
    – dfperry
    Sep 11, 2015 at 13:03
  • 1
    apparently I've gotten two downvotes for giving a correct answer
    – dfperry
    Sep 11, 2015 at 13:04
  • @dfperry Your answer is great, but If we want to add css for tooltip. Any Idea? Apr 29, 2019 at 9:45
  • @PrabhatMaurya you can't style an html tooltip. to get that kind of functionality, you'd need to use a third-party library
    – dfperry
    Apr 30, 2019 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.