Say người ta,Chuyển đổi chuỗi HTML thành thành phần DOM?
var some_html = '<div class = "am_hold">' +
'<img name="bo_im" id="' + val.id + '" class="bookmark_image" src="' + val.favicon + '">' +
'<a target="_blank" name="bookmark_link" class="bookmark_link" href = "' +
val.url + '" id="' + val.id + '">' + val.title + '</a>' +
'<div><div class = "bookmark_menu"></div></div>' +
'</div>';
là nó có thể làm
var some_element = `some_function`(some_html);
Có một thực hiện cho some_function (1) với bằng cách sử dụng một thư viện và (2) bằng cách sử dụng thư viện.
'var d = document.createElement ('div'); d.innerHTML = some_html; '? –
Thử thông tin này 'https: // developer.mozilla.org/vi-US/docs/Code_snippets/HTML_to_DOM' – Eldar