I get using ajax from the server a piece of html code. For example, take the following:
<div id='1'>string1</div> <div id='2'>string2</div> <div id='3'>string3</div> Then it is inserted into the right place with $('selector').html() but before insertion I need to delete, say a div with id='2' . How to do it exactly before pasting the code into the DOM? I know about regex, but I would like to use jquery and a CSS selector.