The problem with that approach is, why even use jQuery for that? Might as
well use .innerHTML = ...

I was hoping to develop a pattern that could be reused, so that the SRC, or
wrapping elements (BR's in this example) can be programmatically set or
modified. This approach does not facilitate that.

Thanks for the feedback though.

On Wed, Dec 17, 2008 at 11:36 AM, brian <bally.z...@gmail.com> wrote:

>
> On Wed, Dec 17, 2008 at 11:13 AM, ken <jqu...@kenman.net> wrote:
> > I need to replace the contents of #foo.
> >
> > I would love to use CSS, and if I were starting anew that would be the
> case,
> > but unfortunately I am working on an existing application converting the
> > plain-jane JS to jQuery. I'm simply trying to replace existing
> functionality
> > WITHOUT affecting the HTML because the HTML is very fragile (the existing
> JS
> > utilizes DOM walking exclusively, so removing/replacing nodes causes a
> > cascade of fail).
>
> ok, then, how about just using a string instead of setting the attributes
> later?
>
> $('#foo').html('<br /><img src="image.gif" /><br />');
>

Reply via email to