0

xhtml:

<ul class="groupsWrapper">
    <ui:repeat value="#{connectDashBoardBean.groups}" var="group">
        <ui:fragment rendered="#{group.activeGroup}">
            <li class="group titleToolTip chooseSubGroup" title="Click To Choose">
                <div style="display: none;" class="groupId">#{group.groupId}</div>
                <div class="groupContainer">
                    <div class="groupImage" style="float:left;color: #fff">
                        <h:graphicImage value="#{group.groupIconPath}" height="70" width="70"/>
                    </div>
                    <div class="groupContent" style="display:inline-block;padding: 0;word-wrap: break-word;font-weight: bold;">
                        <h:outputText value="#{group.groupName}"/>
                    </div>
                    <!-- <div class="groupTotalSubGroup" style="display:block;padding: 0;word-wrap: break-word;">
                        <h:outputText value="Sub Group:#{group.totalSubGroup}"/>
                    </div> -->
                    <div class="groupFollower" style="display:block;padding: 0;word-wrap: break-word;">
                        <h:outputText value="Followers:#{group.totalFollower}"/>
                    </div>
                    <div class="activeThread" style="display:block;padding: 0;word-wrap: break-word;">
                        <h:outputText value="Active Thread:#{group.totalActiveThread}"/>
                    </div>
                </div>
            </li>
        </ui:fragment>
    </ui:repeat>
</ul>

查询:

var group = $(this).find('.groupId').text();

总是让我空空如也,我尝试过text(),html()val()

我在.tooltipster()ajax 调用中使用这个选择器

$('.chooseSubGroup').tooltipster({

    content: 'Loading...',
    functionBefore: function (origin, continueTooltip) {

        // we'll make this function asynchronous and allow the
        // tooltip to go ahead and show the loading notification
        // while fetching our data
        continueTooltip();

        // next, we want to check if our data has already been
        // cached
        if (origin.data('ajax') !== 'cached') {
            var group = $(this).find('.groupId').text();
            alert(group);
            $.ajax({
                type: 'GET',
                url: 'tooltip/sub_group_tooltip.xhtml?groupId=' + group,
                data: {
                    groupId: group
                },
                success: function (data) {
                    // update our tooltip content with our returned
                    // data and cache it
                    origin.tooltipster('update', data).data('ajax',
                        'cached');
                }
            });
        }
    },
    interactive: true,
    interactiveTolerance: 350,
    onlyOne: true,
    theme: '.tooltip-theme',
    trigger: 'click',
    updateAnimation: true,
    arrow: true,
    position: 'right',
    delay: 500
});

请让我知道如何获得隐藏 div 的值?

提前致谢

4

2 回答 2

0

origin.attr("id") 链接_ _ >
http://forum.nickstakenburg.com/index.php?p=/discussion/2596/how-to-do-ajax-tooltip/p1

于 2013-07-31T04:48:44.073 回答
0

工具提示将其对象返回为$(this). 解决方法是

$('.chooseSubGroup').each(function(){
    var $this = $(this);
    $this.tooltipster({
        //other code
        if (origin.data('ajax') !== 'cached') {
        var group = $this.find('.groupId').text();  //note, $this, not $(this)
    });
});
于 2013-07-27T17:57:33.860 回答