JQUERY UI で JQUERY を使用して、短いテキスト文字列のタイトルの値を変更しています。ページが最初に読み込まれると、ツール ヒントは正常に機能し、「クリックして展開」ツール ヒントが表示されます。ユーザーが「more...」または「less...」のテキストをクリックすると、クリック機能がトリガーされます (実際に実行されます)。ブログ投稿の可視性を切り替えます (それが行います); テキストを多めから少なめに、またはその逆に切り替えます (これは行われます)。ボタンのタイトルを更新して、ツール ヒントに新しいテキストが表示されるようにします (Chrome で見られるように更新されます)。ただし、ツールチップは変更されず、タイトルに「Collapse Post」と表示されていても、ツールチップには「Click for more」と表示されています。
JQUERY UI ツールチップが更新を認識し、マウスオーバー時に新しい値を正しく報告する方法でタイトルを動的に更新するにはどうすればよいですか?
/*
*
* @DocumentReady
*/
$(window).ready(function(){ //Checks if the document is ready
/*
*
*
*/
$(".moreButtonClass").click(function(){ //Handles the button click
// just leaves the number and appends to make the div ID
var postID = "#post" + this.id.replace(/[^\d]/g, "");
var moreButton = "#moreButton" + this.id.replace(/[^\d]/g, "");
$(postID).toggle(); // Toggle visibility
if($(postID).is(":visible")) {
$(moreButton).text("less...");
$(moreButton).attr("title", "Collapse Post");
} else {
$(moreButton).text("more...");
$(moreButton).attr("title", "Show Post");
}
}); //Close the function
/*
*
*
*/
$( "#tabs" ).tabs({
beforeLoad: function( event, ui ) {
ui.jqXHR.error(function() {
ui.panel.html(
"Couldn't load this tab. We'll try to fix this as soon as possible. ");
});
}
}); // Close the function
/*
*
*/
$(function() {
$( document ).tooltip({track: true}); // Allow JQUERY to handle tooltips
}); // Close the function
}); // Close the Document Ready Function