ビューティー ヒント プラグインをどのように更新しますか? クリック イベント時に要素に適用されるビューティー ヒントを変更しようとしています。どちらでも嬉しいです
クリックされたときにその要素のビューティ ヒントを無効にするか、
クリックすると美容のヒントの内容が変わります。
「options」配列を問題なく変更できるようですが、その変更が美容のヒントに反映されていません。
ビューティー ヒント プラグインをどのように更新しますか? クリック イベント時に要素に適用されるビューティー ヒントを変更しようとしています。どちらでも嬉しいです
クリックされたときにその要素のビューティ ヒントを無効にするか、
クリックすると美容のヒントの内容が変わります。
「options」配列を問題なく変更できるようですが、その変更が美容のヒントに反映されていません。
I had the same problem recently; in my case I needed to update a tooltip on the parent element of a select
whenever the selection changed (with the tooltip contents based on the title
element of the selected option
). To get the tooltip to update on an element, i.e. to get its contents to change, you need to:
remove the attribute that BT uses to store the original title (so that it doesn't think it's already handled the element),
set the element's title
attribute to the new content you wish to display in the updated tooltip,
call the bt()
function again to create the updated tooltip.
For instance:
element.removeAttr('bt-xtitle');
element.attr('title', 'new tooltip content');
element.bt();
Obviously this assumes that you're using the default title
attribute to generate the content, if you're using a custom contentSelector
like a div
, you'll need to adjust the code accordingly but the concept should remain the same.
Hopefully this can help someone trying to achieve the same thing, since it's not very intuitive how to do this.
要素で BT を無効にするには、次の構文を使用します。
$('selector').btOff();
BT の使用を再度有効にするには:
$('selector').btOn();