2011-09-30 69 views
0

如果我有以下瓦爾匹配文本屬性值w/jQuery的

var $headers = $("#myTbl th").not(":first"); 

var $this = $(this); 

如何匹配$ this.text(); 以內標題標籤內th

<th title="match this title">value</th> 

這似乎並不工作:

$headers.filter(":contains(" + $this.text() + ")"); 

回答

2
var title = $("#myTbl th").not(":first").attr("title"); 
var $headers = $("#myTbl th[title='"+title+"']"); 

這樣的事情應該這樣做