Opened 16 years ago
Closed 16 years ago
#2248 closed defect (bug) (no action required)
auto alt class elements - problems when adding ul li to the loop
| Reported by: | nuprn1 | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.5 |
| Component: | Core | Version: | |
| Severity: | Keywords: | ||
| Cc: |
Description
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">
`
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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) {
});