2015-07-10 82 views
-1

我想改變字體&的顏色使內容ALIGN =在追加function.The內容的內容「中心」是值從DB &數組中取出。 請幫忙!如何添加樣式附加功能

currentrow 
    .find('td') 
    .next() 
    .css('background-color', 'red') 
    .addClass('active') 
    .attr("title", namearray[j]) 
    .append(namearray[j]); 
+0

'對於th的內容e附加功能'??該功能的內容是什麼? –

+0

它是從數組中獲取的數值,即namearray [j] –

+0

'namearray [j]'裏面的內容?一個html元素或一個純字符串或一個html字符串? –

回答

1

在這裏你去,,

http://codepen.io/mkdizajn/pen/pJVWem?editors=101

希望解決它..

我認爲關鍵的部分是這樣的:

$('table tr') 
    .eq(1) // find second row for ex.. 
    .find('td').eq(1) // find second cell for ex.. 
    .css('background-color', 'red') // give it some color 
    .addClass('active').attr("title", 'mirko').css('text-align', 'center') // center position 
; 

心連心

+0

感謝您的代碼,但先生我希望它的.append() –

+0

你也可以使用附加,我補充說:) –

+0

根據我的要求得到所需的結果。感謝您的幫助 ! –