等效于jquery对象.get()方法

时间:2018-10-18 13:52:22

标签: jquery

这个问题听起来可能很愚蠢,但是是否有一个将选择器作为参数的JQuery对象方法
JQueryObjectArray.get('index')
等效?我一直在找几个小时,没有成功。

<div>
    <div>
        <ul>
            <li>...</li>
            <li>...</li>
            <li>...</li>
            <li>...</li>
            <li>...</li>
        </ul>
    </div>
</div>

var list = $('selector'); //selection is an array of JQuery objects.
/* the selector is complex and large (this is a sample), I use a variable to make the code cleaner */
...
list.get(':hover').val(function() {...});

重要说明:
我说的是JQuery 对象 .get()方法,而不是JQuery函数。

这是有关.get()的JQuery手册:https://api.jquery.com/get/

我找到的解决方案(但我不喜欢):

list.parent().children(':hover').val(function() {...});

1 个答案:

答案 0 :(得分:1)

使用.filter 方法

:hover

但是不确定使用import matplotlib.pyplot as plt, mpld3 plt.scatter(points[0], points[1], color='r') mpld3.show() 作为选择器要完成什么。当前不存在。