2013-12-22 99 views
0

我建立基於引導的WordPress主題,並在默認的WordPress日曆小部件,造型與引導樣式不匹配。將類添加到特定的表php或jquery解決方案?

但是,它很容易匹配日曆小部件中列的寬度。

當小部件被激活它包裹在

<table id="wp-calendar"> 

如果我不知怎麼能添加類到該表與特定ID,我會解決問題的造型。

所以基本上代替

<table id="wp-calendar"> 

我需要有

<table id="wp-calendar" class="table table-responsive table-striped"> 

是否有解決方案添加類特定表與ID?

一些PHP函數或jQuery?

回答

2

使用jQuery

$("#wp-calendar").addClass("table table-responsive table-striped"); 
+0

謝謝你,我不知道是哪一個upvote和接受,你得到了所有相同的答案如此生病與第一個:P –

1
$('#wp-calendar').addClass('table table-responsive table-striped'); 
1

使用jQuery你可以做到這一點,如:

// document ready 
$(function(){ 
    $('#wp-calendar').addClass('table table-responsive table-striped'); 
}); 
1

那麼,在jQuery的解決方案會是什麼樣子:

$('#wp-calendar').addClass('table table-responsive table-striped'); 

參考:

1

可以很明顯的更改原始的HTML和硬代碼的類名

<table id="wp-calendar" class="table table-responsive table-striped"> 

或者您可以使用jQuery功能addClass

$('#wp-calendar').addClass('table table-responsive table-striped'); 
+1

JS≠jQuery ;-) – LeBen

相關問題