How can I remove the css classes from a richfaces component?

六眼飞鱼酱① 提交于 2019-12-01 07:31:26

问题


I'm using a rich:simpleTogglePanel and it puts these 3 css classes on the divs:

rich-stglpanel
rich-stglpanel-header
rich-stglpnl-marker
rich-stglpanel-body

Is there any way that I can remove those classes?


回答1:


Every Richfaces component comes with a set of CSS classes. These CSS classes are used to customize the aspect of your toggle panel (or any other RF component). The four CSS classes, as explained in the component guide, are indeed attached to the HTML components generated by the RF framework.

There are 2 solutions for you:

  1. Customize your CSS in order to extend the default properties of the four CSS classes. This way, you will have the rendering you want for this component.
  2. Remove the CSS classes using JavaScript (not recommanded).

The second solution can be achieved easily with some jQuery script:

jQuery(document).ready(function() {
    jQuery(".rich-stglpanel").removeClass("rich-stglpanel");
    ...
});

(this means once the page is loaded, find all elements with CSS class rich-stglpanel and remove this class).



来源:https://stackoverflow.com/questions/4455018/how-can-i-remove-the-css-classes-from-a-richfaces-component

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!