2012-02-11 3 views
5

클릭 한 셀 위의 셀의 아래쪽 테두리 너비를 검색해야합니다.위의 셀에서 데이터 가져 오기

var $this = $(this); 
var col = $this.parent().children().index($this); 
var row = $this.parent().parent().children().index($this.parent()); 
var bordWidth= ($this.parents('tr:eq('+(row-1)+')').find('td:eq('+col+')').css("border-bottom-width")); 
+1

이전 질문에서 답변을 입력했지만 게시하려면 먼저 삭제했습니다. 새 질문을 게시하는 대신 원래 질문을 수정하여 새 세부 정보를 포함하십시오. –

+0

나는 [이 스레드] (http://stackoverflow.com/questions/3787502/how-to-get-border-width-in-jquery-javascript) 귀하의 질문에 대답해야한다고 생각합니다. – jurgemaister

+0

@ RobW- 죄송합니다. 저의 이전 질문은 너무 광범위해서 하나가 아닌 10 개의 질문으로 이루어졌습니다. – maddogandnoriko

답변

10

시도해보십시오.

var $this = $(this); 
var $tr = $this.parent(); 
var col = $tr.children().index($this); 
var bordWidth = $tr.prev().children().eq(col).css("border-bottom-width"); 

.prev() 이전 tr 요소를 가져온 다음 .children() 모든 td 년대를 얻고 eq() 방법을 사용하여 필요한 TD를 얻을 사용합니다.