如何从查询中获取li元素的值

时间:2013-07-27 16:14:46

标签: jquery jsf-2 tooltip

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>

Jquery的:

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

总是让我空虚,我尝试使用text()html()val()

我在ajax调用的.tooltipster()内使用此选择器

$('.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的价值?

提前致谢

1 个答案:

答案 0 :(得分:0)