Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のようなhtml要素を含む文字列があります
var elements = "<div class='instance' id=''><h1></h1></div>";
このように作ることができるようにするためにどのようにそれを扱うことができますか
$('instance').prop('id',5); $('instance h1').html('hello all');
新しい jQuery オブジェクトに直接ロードできます。
$(elements).find("h1").html("Hello All").appendTo("body");
また、5は有効ではありません。値idの先頭に数字を使用しないでくださいid。
5
id