如何实时更新Jquery UI工具提示中的内容? [英] How do I Update the Content in Jquery UI Tooltip in Realtime?

查看:167
本文介绍了如何实时更新Jquery UI工具提示中的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个元素,当悬停时,它显示物品的价格(在游戏中).我正在使用jQuery UI工具提示来增强有关每个项目的信息的显示.单击该项目时,jQuery捕获该点击,使用$ .get()请求来处理购买,并可以通过JSON和jQuery的parseJSON功能返回与该项目相关的特定信息.

I have an element that when hovered over, it displays the price of the item (in a game). I'm using the jQuery UI tooltip to power the display of the information about each item. When the item is clicked, jQuery captures the click, uses a $.get() request to process the purchase and can return specific information related to the item via JSON and jQuery's parseJSON feature.

但是,每件商品的价格随每次购买而变化.这是一种通货膨胀形式.我无法弄清楚如何访问jQuery UI工具提示的内容来更改其内容,以便在其仍显示时甚至不显示时,更改其内容的值以反映新的价格.

However, the prices of each item change with each purchase. It's sort of a form of inflation. I can't figure out how to access the content of the jQuery UI tooltip to change it's content so that while it is still displayed or even when it's not displayed, to change the value of it's content to reflect the new prices.

我需要怎么做才能实时更改内容?

What do I need to do to change that content in real time?

推荐答案

初始化后,您可以更改jQuery Tooltip的内容,如下所示:

You can change the content of jQuery Tooltip after initialization as follows:

$( ".selector" ).tooltip( "option", "content", "Awesome title!" );

这是演示.

有关详细信息,请参见 API .

See the API for more details.

这篇关于如何实时更新Jquery UI工具提示中的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆