jQuery插件正在应用内联样式(display:block)。我感觉很懒,想用display:none重写它。

最好的(懒惰的)方法是什么?


当前回答

.removeAttr("style")来去掉整个style标签…

.attr("style")来测试值,看看是否存在内联样式…

.attr("style",newValue)将其设置为其他值

其他回答

将插件更改为不再应用该样式。这比随后删除样式要好得多。

.removeAttr("style")来去掉整个style标签…

.attr("style")来测试值,看看是否存在内联样式…

.attr("style",newValue)将其设置为其他值

$("[style*=block]").hide();
$('div[style*=block]').removeAttr('style');

$("#element").css({display: "none"});

起初,我试图删除css中的内联样式,但它不起作用,新样式如display: none将被覆盖。但在JQuery中,它是这样工作的。