开发者

How to prevent adding CSS 'class' properties

开发者 https://www.devze.com 2023-03-22 15:32 出处:网络
I am using Ruby on Rails 3.0.9, jQuery 1.6.2 and jQuery UI. I am trying to implement nested tabs by following the official documentation.

I am using Ruby on Rails 3.0.9, jQuery 1.6.2 and jQuery UI. I am trying to implement nested tabs by following the official documentation.

When I state the following (that is the "normal"\"common" way as stated in the documentation source code)

<div id="tabs">
  <ul>
    <li>...</li>
  </ul>
</div>

<script>
  $(function() {
    $( "#tabs" ).tabs();
  });
</script>

and then I go to display the HTML code generated, jQuery UI automatically add the following CSS class properties to the <div id="tabs">:

<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
  ...
</div>

Is it possible to prevent adding some of those CSS clas开发者_如何学JAVAses? If so, how to do that?


You can always $("#tabs").removeClass("whatever") if you want, but you'll likely lose certain functionality if you do. The real question is why do you want to do this?


If you don't want the CSS effects that the tabs are giving, just remove the styles from the CSS document.


I would override the styles on the pages where you don't want the effect. For example if ui-corner-all has a property of float:left in the jquery UI style sheet and that style is interfering with your page. It would be best to have a class by the same name on the page you're working on to override the style. It would be less expensive than modifying the dom to remove classes.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号