[jQuery] Re: remove question

2009-06-13 Thread David .Wu

Nice trick.

On 6月13日, 上午9時36分, brian bally.z...@gmail.com wrote:
 On Fri, Jun 12, 2009 at 2:37 PM, amuhlouamysch...@gmail.com wrote:

  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

 There's no need for remove() because it will have been replaced already.


[jQuery] Re: remove question

2009-06-12 Thread Kean

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


[jQuery] Re: remove question

2009-06-12 Thread amuhlou

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


[jQuery] Re: remove question

2009-06-12 Thread brian

On Fri, Jun 12, 2009 at 2:37 PM, amuhlouamysch...@gmail.com wrote:

 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

There's no need for remove() because it will have been replaced already.


[jQuery] Re: remove question

2009-06-11 Thread Steven Yang
i guess you just have to move div 2 somewhere else before you remove div 1


[jQuery] Re: remove question

2009-06-11 Thread brian

On Thu, Jun 11, 2009 at 10:44 PM, David .Wuchan1...@gmail.com wrote:

 Can I remove div1 but div2 keep there?

 div id=1
 div id=2/div
 /div

Someone (Karl?) answered the same question recently. You just replace
the outer div with the inner.

Note that you can't have an element ID starting with a number, though.
Let's call them div_1  div_2.

$('#div_1').replaceWith($('#div_2'));