The only js code I use is this:
jQuery("#myTable tr:even").addClass("even");

Then in my CSS file, I define what background color the .even class
will have.


Steven



On 13 Mai, 22:25, MorningZ <morni...@gmail.com> wrote:
> You have
>
> ------------------------------------------------------
> $('#event-listing tbody tr:odd').css("background-color", "#EFF1F1");
> $('#event-listing tbody tr:even').css("background-color", "#A4D1FF");
>
> var html = '<tr height="35" style="font-size:smaller;"
> align="center">';
> html += '<td>' + startdate + '</td>';
> html += '<td>' + location + '</td>';
> html += '<td>' + event_name + '</td>';
> html += '<td>' + speaker + '</td>';
> if(info == "specific") {
>     html += '<td>' + currentpricing + '</td>';}
>
> html += '</tr>';
> $('#event-listing tbody').append($(html));
> ------------------------------------------------------
>
> until you call that ".append()" method, that row does not exist on the
> DOM to manipulate yet
>
> so
>
> ------------------------------------------------------
> var html = '<tr height="35" style="font-size:smaller;"
> align="center">';
> html += '<td>' + startdate + '</td>';
> html += '<td>' + location + '</td>';
> html += '<td>' + event_name + '</td>';
> html += '<td>' + speaker + '</td>';
> if(info == "specific") {
>     html += '<td>' + currentpricing + '</td>';}
>
> html += '</tr>';
> $('#event-listing tbody').append($(html));
>
> //Now that added row exists in the DOM
>
> $('#event-listing tbody tr:odd').css("background-color", "#EFF1F1");
> $('#event-listing tbody tr:even').css("background-color", "#A4D1FF");
> ------------------------------------------------------
>
> On May 13, 3:46 pm, Shadraq <shadraq.thee...@gmail.com> wrote:
>
>
>
> > Morning Z,
>
> > Thanks for the quick reply. I must not be completely understanding
> > what you are saying (though, it sounds very simple). I moved my tr:odd/
> > even tags to 3 different places:
>
> > 1. just after the <tr> was set
> > 2. after the </tr>
> > 3. after <tr was opened bu before it was closed ">"
>
> > Do I need to add "html +=" to it? Am I missing something?
>
> > Thanks for your time,
> > Shadraq

Reply via email to