我想使用jQuery選擇器添加一些內容到DOM,但我想在它被添加之前操作它。jQuery選擇器在添加到DOM之前編輯HTML
var $content = $('<h1>title</h1><h2 id="xx">remove me</h2><p>some content or other</p>');
$content.remove('#xx');
$('#output').append($content);
我已經把這個的jsfiddle這裏http://jsfiddle.net/NNcG5/1/
非常感謝, 麥克
+ 1..Very Simple..welcome to SO – 2012-07-14 15:04:38
謝謝,感謝! – Martin 2012-07-14 16:27:09