putting it all together, you'd get something like: $('#div1').replaceWith($('#div2')).remove();
first you find div1, then replace it with div2, then remove div1 On Jun 12, 2:12 pm, Kean <shenan...@gmail.com> wrote: > W3C says that id should not start with a number > > Here's probably what you need. > > $('#1').remove(); > > On Jun 11, 7:44 pm, "David .Wu" <chan1...@gmail.com> wrote: > > > Can I remove div1 but div2 keep there? > > > <div id="1"> > > <div id="2"></div> > > </div>