jquery-context

What is the second argument in this jquery select statement?

*爱你&永不变心* 提交于 2019-12-24 17:05:03
问题 I have seen it here. What is meant by tbl in the following statement? What does it imply? var rows = $('tr', tbl); 回答1: The tbl in the above is another dom element. This is passed in as the (optional parameter) context : jQuery( selector [, context ] ) ...for the selector , in this case 'tr' . source So essentially this: $('tr', tbl); says return me everything that matches the selector 'tr' in the element(s) tbl . Example So given <table> <tr>first</tr> <table> <table id="test"> <tr>second<