本文介绍了此jquery select语句中的第二个参数是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在此处看到了它.以下语句中的tbl是什么意思?这意味着什么?
I have seen it here. What is meant by tbl in the following statement? What does it imply?
var rows = $('tr', tbl);推荐答案
上面的tbl是另一个dom元素.这作为(可选参数)context传递:
The tbl in the above is another dom element. This is passed in as the (optional parameter) context:
jQuery( selector [, context ] )...对于selector,在这种情况下为'tr'.
...for the selector, in this case 'tr'.
基本上就是这样:
$('tr', tbl);说返回与元素tbl 中的选择器'tr'匹配的所有内容.
给定
<table> <tr>first</tr> <table> <table id="test"> <tr>second</tr> </table>这将返回不同的结果:
//context is global $('tr') => first & second //restrict the context to just the second table //by finding it and passing it into the selector var tbl = $('#test'); $('tr', tbl) => just second更多推荐
此jquery select语句中的第二个参数是什么?
发布评论