我如何使用jquery获取此div的内容

leo*_*ora 2 asp.net-mvc jquery qtip

当我突出显示" class = div "中的任何文本时,我想显示工具提示.我有以下HTML:

<div class='test'>Test</div>
<div class='tooltip'>Tooltip 1</div>

<div class='test'>Test 2</div>
<div class='tooltip'>Tooltip 2</div>

<div class='test'>Test 4</div>
<div class='tooltip'>Tooltip 4</div>
Run Code Online (Sandbox Code Playgroud)

和以下javascript:

<script type="text/javascript">
        $(document).ready(function () {

            $('div.test').each(function () {

                var tooltipHtml = //NEED to figure out how get the html of the Tooltip div below this current div
                $(this).qtip({
                    content: {
                        text: tooltipHtml
                    },
                    style: { width: 450 }
                });
            });
        });
Run Code Online (Sandbox Code Playgroud)

我如何从"下一个"工具提示div获取html?

Bla*_*lan 5

1:使用jQuery next()来选择它.

var tooltipHtml = $(this).next('.tooltip').html();
Run Code Online (Sandbox Code Playgroud)