[HTML CSS JS]阻止用户使用before元素更改值

问题描述 投票:0回答:1

我想在选择器之前使用输入阻止三个表。通过jquery我将class disabled-元素添加到每个表:

$("table").toggleClass("disabled-element");

这是我在css中的disabled-element:

.disabled-element::before {
  background-color: #4e555b;
  opacity: 0.5;
  z-index: 10;
  position: absolute;
  height: 100%;
  width: 100%;
  content: ""; 
}

表结构:

<table class="table table-stripped">
<thead>
  <th scope="col">Rotor Number</th>
  <th scope="col">Current values</th>
</thead>
</table>
<tbody>
<tr>
  <td></td><td></td>
</tr>
</tbody>

但看起来这个类只被添加到选择器:enter image description here

javascript jquery html5 css3
1个回答
0
投票

我错过了父母元素的position: relative声明

© www.soinside.com 2019 - 2024. All rights reserved.