使用jQuery Tooltipster扩展,我做了一个内联工具提示,如下所示:
<span class="tooltip" data-tooltip-content="#tooltip_content">This span has a tooltip with HTML when you hover over it!</span>
<div class="tooltip_templates">
<span id="tooltip_content">
<img src="myimage.png" />
<strong>This is the content of my tooltip!</strong>
</span>
</div>
但是,一旦我将鼠标悬停在工具提示上,html就会从"tooltip_templates"中删除。然后,它被附加到页面末尾,但仅在悬停时。这是一个问题,因为当通过 Ajax 更新字段时,我有时需要编辑工具提示的内容,但我无法使用 jQuery 在工具提示中找到元素,因为它似乎不在 DOM 中的任何地方第一次使用工具提示。任何想法如何编辑工具提示 DOM 或将工具提示 html 保留在 DOM 中以便可以找到它?谢谢
可以使用 content
方法随时访问工具提示的内容。