1

リンクがテンプレートの外にある場合、ツールチップは正常に機能しますが、JQuery テンプレート内の場合はまったく機能しません。多くの例を試しましたが、成功しませんでした。

以下はコードです

グリッドがロードされた後の Js ファイル内

ReloadGrid();

$(".hello").tooltip({
    track: true,
    delay: 0,
    showURL: false,
    fade: 250,
    bodyHandler: function () {
        return $($(this).next().html());
    },
    showURL: false
});

ページ上

<script id="cellTemplate" type="text/x-jQuery-tmpl">
    <tr  class="gridRowCursor"  >
        <td class="cellTd ">
            <input type="checkbox" id="deleteCb" />
            <input type="hidden" id="Id_ + ${Id}" class="idField" value="${Id}" />
        </td>
        <td class="cellTd">
            <input id="index" name="index" class="numberField" type="text" value="${IndexOrder}" />
        </td>
        <td  class="cellTdLeft" style="font-size:11px;">

            <a class="hello"  href="#">{{html DisplayName}}</a>

          <div id="tooltip" style="display: none">
                <div>
                   {{html UrlName}}
                </div>
            </div>



        </td>
        <td class="cellTd ">
            <input type="checkbox" id="activeCb" {{if Active}} checked{{/if}} />
        </td>
    </tr>
    <tr id="${Id}" class="gridRow" style="display: none;">
        <td class="cellTdLeft" colspan="5" style="padding-left: 15px; font-size:11px;">
            {{html UrlName}}
        </td>
    </tr>
</script>   


<span class="instructions">Only numeric value is allowed in IndexOrder textbox.</span>
<div class="gridDiv">
<table id="set1" class="gridTable" cellspacing="0" cellpadding="0" >
    <thead>
        <tr class="gridTitleRow">
            <td class="iconLink width36">Delete</td>
            <td class="iconLink width60">Sort Order</td>
            <td class="iconLink width500">Display Name</td>
            <td class="iconLink widthAuto">Active</td>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>
</div>

以下のように Live を使用します。動作していませんか?

$(".hello").live("tooltip", function() {
     track: true,
delay: 0,
showURL: false,
fade: 250,
bodyHandler: function () {
    return $($(this).next().html());
},
showURL: false

});
4

1 に答える 1

0

$(".hello").live("tooltip", function(){ 代わりに $(".hello").tooltip({

あなたの hello クラス要素は、ロードされたときに dom の一部ではないため、コードはおそらくまだ存在しないものを接続しようとしています。live メソッドは、クラス hello を持つ将来のすべての要素にツールヒント イベントが追加されるようにします。

于 2011-08-25T03:50:40.023 に答える