var span = '<span class="we w_o_r_d_s" id="we" contenteditable="false">we</span>'
console.log(span.id);
console.log(span.attr('id'));
console.log(span.getAttribute('id'));
var div = document.createElement('div');
div.innerHTML = span;
console.log(div.id);
console.log(div.attr('id'));
console.log(div.getAttribute('id'));
//I want to log `we`
http://jsfiddle.net/3BTdk/1/如何獲取表示爲字符串的範圍內的id?
我看着here但無法得到它。謝謝。