Thank Klaus ... I didn't know that it is invalid to put list inside a <p>
cheers, james On Aug 6, 1:45 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote: > james_027 wrote: > > hi, > > > I have something like this .. > > > <p id="similar_employees"> > > > Theare are 2 similar employee(s). > > <ul> > > > <li>Bondoc Sheryl</li> > > > <li>Bondoc Sheryl</li> > > > </ul> > > > jquery > > </p> > > > when I execute > > > $('[EMAIL PROTECTED]').html(data); > > > where the data is equal to > > > *** There are 2 similar employee(s). > > <ul> > > > <li>Bondoc Sheryl ***</li> > > > <li>Bondoc Sheryl ***</li> > > > </ul> > > > I am expecting the whole content inside the <p id="similar_employees"> > > will be replace with the value inside the data. but the result is only > > the sentence "There are 2 similar employees(s)." are replace and the > > rest where appended. it looks like this > > > <p id="similar_employees"> > > > *** Theare are 2 similar employee(s). > > <ul> > > > <li>Bondoc Sheryl ***</li> > > > <li>Bondoc Sheryl ***</li> > > > </ul> > > > <ul> > > > <li>Bondoc Sheryl ***</li> > > > <li>Bondoc Sheryl ***</li> > > > </ul> > > > jquery > > </p> > > > Then I try ... $('[EMAIL PROTECTED]').empty() on the original > > content, the result is only the "There are 2 similar employee(s)" > > where remove and the rest remain... > > > Could someone point me where did I get wrong or Is there a known bug? > > > Thanks > > james > > This is a typical case of running into unexpected results because of > invalid HTML. A p element must not contain a list. What happens here is > that a browser implicitly closes the paragraph before the list starts. > > You need to fix your HTML. Scripting on top of an invald DOM won't make > yout life easier. > > --Klaus