It sounds like you want to use the .after() method rather than .append()

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Oct 31, 2009, at 11:06 AM, jmatthews wrote:

This is related to an earlier post, but rather than address it is a
selecting issue, I am thinking it is an append issue.  I'd like
others' thoughts on this.

If you have:

<div id="mymouse">Hello</div>

You can control the innerHTML through Jquery mouseover(), etc.  Simple
enough.

If you have:

<div id="mymouse">Hello<div>Goodbye</div></div>

The mouseover, I believe, still on effects the Hello, recognizing it
is the innerHTML of the tag with the id="mymouse."

However, using the original example, if you APPEND like this:

<div id="mymouse">Hello</div>

.... and somewhere in your script, you append by: $ ("#mymouse).append
("<div>Goodbye</div>")

The mouseover() to "mymouse" now controls the next div.

I think the append assumes all appended material is more innerHTML and
not necessarily new sections of a document.

Does anybody else agree and see this as a "not so proper" working of
the append() method?

(I have not tested the example I just wrote, but it is my observation
based on my application, which uses append() to add new document
sections.  In my application, I have been struggling with mouseover
being inherited by the appended sections.  I have tried to modify the
program to set particular mouseovers in the new HTML tags that are
part of the appended materials - like appending <div
onmouseover="mymouse2">Goodbye</div> - all to no avail.)




Reply via email to