Jquery version of yui .getElementsBy
Jquery version of yui .getElementsBy
我正在尝试为web应用程序从YUI更新到jQuery;不过,我对在jQuery工作还是个新手。我在YUI:中有这个代码块
function getChildUL(childEl){
var childrenUL = YAHOO.util.Dom.getElementsBy(
function(element) {
return element.parentNode == childEl;
}, "UL", childEl);
childrenUL = childrenUL[childrenUL.length-1];
return childrenUL;
}
我找到了这个链接,并尝试根据接受的答案在jQuery中重写该块。我越来越不适合儿童UL。这是我的尝试:
function getChildUL(childEl){
var childrenUL = $("UL").filter(function(element) {
return element.parentNode == childEl;
}).get();
childrenUL = childrenUL[childrenUL.length-1];
return childrenUL;
}
感谢您的帮助。
您的代码中有一个错误:parentNode不是jQuery函数。我认为您应该使用parent()或closest()数。
相关文章:
- 如何在屏幕外或项目的中心视口中跟随YUI驱动的动画
- 鼠标输入在 YUI 的 chrome 中不起作用
- 使用KnockoutJS绑定的YUI DataTable
- YUI向json文件发出ajax请求
- YUI 3:将值设置为多选
- 如何停止YUI事件侦听器
- YUI Compressor特别评论在JS中添加了分号
- jQuery and YUI load
- 使用YUI或ExtJS将隐藏的DIV变成一个窗口
- c#转换为用于YUI日历的javascript
- 在方形空间 (YUI) 上重绘元素时出现问题
- Yui Get 复选框返回数组而不是布尔值
- 使用 YUI 3 跟踪 jQuery.extend
- YUI Compressor Maven Mojo缩小javascript的用法
- 同时调用js函数yui
- YUI嵌套选择器
- 如何在网站中实现YUI压缩器
- YUI应用程序转换”;闪烁”;在showView上
- Jquery version of yui .getElementsBy
- YUI.getElementsBy equivalent to jQuery