0
我有<tr id="tr_color" >
,我想這樣做使得當我點擊該td
中的按鈕「活動帳戶」時,值「1」將添加到列中'active_account'在數據庫中,這與我一起工作。 td
的background-color
也會變成藍色,問題在這裏!不隨我改變。使用JavaScript/ajax點擊按鈕更改特定TD的背景顏色
的JavaScript
<script type="text/javascript">
function active_user_account() {
jQuery.ajax({
url: "check_data.php",
data:'conf_data='+ document.getElementById("active_account").value + '&id='+ document.getElementById("id_this_user").value,
type: "POST",
success:function(data){
document.getElementById("tr_color").style.backgroundColor = "blue !important";
},
error:function(){}
});
}
</script>
TR或TD?你的代碼中有
回答
你不能在使用JavaScript添加樣式
!important
。更改爲它應該工作。另外,如果你確實需要使用
!important
,嘗試用一類,而不是這樣做:與下面的CSS:
來源
2017-01-14 23:46:05
同樣的問題,當我添加類像你說什麼不工作!每當我點擊按鈕添加一個新的類在tr :( –
@BudoorAyhd你可以讓小提琴顯示問題? –
相關問題