Skip to:

Opened 12 years ago

Closed 12 years ago

#2248 closed defect (bug) (no action required)

auto alt class elements - problems when adding ul li to the loop

Reported by: nuprn1's profile nuprn1 Owned by:
Milestone: 1.5 Priority: minor
Severity: Version:
Component: Core Keywords:


I noticed that class="alt" is automagically added to loop items - but if I'm inserting html code which contains a ul/li - the alternating backgrounds will break.

<ul class="item-list" id="topic-post-list">
<li id="post-45" class="alt">
<li id="post-46" class="alt">
<li id="post-47">
<li id="post-48" class="alt">
<li id="post-49" class="alt">

Change History (1)

#1 @mrmaz
12 years ago

  • Resolution set to invalid
  • Status changed from new to closed

I don't think this is a bug since you are modifying the DOM on your own. I'm not sure if we should add bloat to the JS API to automatically support a lot of these one-off cases.

After you insert your html you need to call something like this...

j('ul#topic-post-list li').removeClass('alt');

j('ul#topic-post-list li').each( function(i) {

if ( i % 2 != 1 )



Note: See TracTickets for help on using tickets.