私はjquery-uiで作業しています。タイトル付きの要素を作成し、タイトルを表示できます。ただし、クリックすると、タイトルを取得して別の div に入力したいと思います (これは、タッチ対応デバイスにツールチップがないためです)。クリック イベントを取得できますが、クリック イベント中にタイトルを取得できません。
$("div").click(function( event ) {
// just to prove that we are entering this event
$("#preShow").html ( Date() );
// show the title
var toolTip = this.attributes.title.value;
$("#show").html ( toolTip );
// just to prove that there was no crash
$("#postShow").html ( Date() );
});
私も使ってみました
var toolTip = $(this).attr ("title");
ここに問題を示すjsfiddleがあります
HTMLファイルを作成し、クリック イベントの最初の行にブレークポイントを設定して Firefox で実行すると、同じコードが機能します。誰もこれを経験しましたか?