Ok then: $('div.box[title]').each(function(){ $('<h3 />').text( this.title ).prependTo(this); });
Note that you're giving non-js users (and search engines) less semantical html. You probably want google to recognize (sub)titles on your pages. -- Ariel Flesler http://flesler.blogspot.com/ On Aug 21, 10:33 pm, Rob <[EMAIL PROTECTED]> wrote: > Thanks for the reply, but I think what you did was take the first way > and convert it to the second. I think anyway, I gave it a shot just > in case and it didn't end up as desired. > > What I'd like to do is start writing my "box" divs like the second way > (without the nested h3 and div) so there's less reduntant and repeated > code. Thus the javascript would take the second, more streamlined, > div and expand it to an end result that looks like the first did > originally. > > On Aug 21, 8:01 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > Whether or not this should be done, I don't know. It modifies the way > > the user gets the title (much more subtle/hidden the second way). > > > How to do this ? > > > $('div.box').each(function(){ > > this.title = $(this).find('h3').remove().attr('title') || ''; > > > }); > > > -- > > Ariel Fleslerhttp://flesler.blogspot.com/ > > > On Aug 21, 6:36 pm, Rob <[EMAIL PROTECTED]> wrote: > > > > I'm very new to jquery and I'm finding that I'm flooding myself with > > > ideas of how to use it! Good stuff. > > > > I have this repeating pattern on my site: > > > > <div class="box"> > > > <h3>Some Neat Title</h3> > > > <div class="boxContent"> > > > Some neat content... > > > </div> > > > </div> > > > > What I think would be cool is to change that to the below and just put > > > some script in my site's startup script that looks for all divs with > > > the class "box" and modifies them so the ending result is like the > > > above. > > > > <div class="box" title="Some Neat Title"> > > > <p>Some neat content</p> > > > </div> > > > > What do you think? > > > > Thanks in advance, > > > Rob- Hide quoted text - > > > - Show quoted text -