I am trying to manipulate some html that is in a text box (and not part of the page), but I want to be able to execute jQuery functions on it.
Here I am trying to remove a div with attr 'my_id' from 1234, but the resulting data remains the same?
var data = "<div>something<div my_id='1224'>blah</div><div my_id='1234'>xx123</div></div>"; var id = '1234'; $(data).remove('[my_id="'+id+'"]'); alert($(data).html());
Obviously, a warning is just used for debugging.
source share