防止子元素使用父类

时间:2018-09-21 09:45:54

标签: css inheritance parent-child

我在这种情况下遇到问题,我有一个带有一个用于跟踪表单状态的全局类的小型表单,但是现在我有一个复选框,我不想继承该父类。 ..那么如何预防呢?

<div id="find_employee" class="myCustomClass">
<div class="col-lg-3">
            <div class="form-group">
                <label for="employee_last_name">Last Name</label>
                <input id="employee_last_name" name="employee_last_name" type="text" maxlength="30" class="form-control filterItem" placeholder="Last Name">
            </div>
        </div>
        <div class="col-lg-3">
            <div class="form-group">
                <label for="employee_first_name">First Name</label>
                <input id="employee_first_name" name="employee_first_name" type="text" maxlength="30" class="form-control filterItem" placeholder="First Name">
            </div>
        </div>
        <div class="col-lg-3">
            <div class="form-group">
                <label for="employeeID">Employee ID #</label>
                <input id="employeeID" name="employeeID" type="text" maxlength="10" class="form-control filterItem" placeholder="Employee ID #">
            </div>
        </div>
<div class="col-lg-12">
            <div class="form-group">
                <input type="checkbox" name="isActiveEmployee" id="isActiveEmployee" value="false" />
                <label for="isActiveEmployee">Include Inactive Employee</label>
            </div>
</div>

如何在底部的复选框元素上禁用myCustomClass?通过js,jquery或CSS?

1 个答案:

答案 0 :(得分:1)

将myCheckboxClass添加到复选框,然后在myCustomClass上使用not选择器

minimize