How to add property to existing class

后端 未结 6 1557

I have got a CSS class like so:

.simpleClass {
    width: 25px;
}

And I have a matching element:

6条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-19 12:14

    The stylesheet is defined in a file, and you can't edit that with JavaScript. What you could do is this:

    $(".simpleClass").live("domchanged", function() {
        $(this).css("display", "none");
    });
    

    But this is neither not cross-browser compatible nor efficient (nor tested by me ;). So I'd propose to use another predefined CSS class for this purpose. Why do you need something like this anyway?

提交回复
热议问题