Here's a non-elegant, but working solution:
// create a new <a> element
new_element = $("<a/>");
// iterate over every attribute of the #some_id span element
$.each($("#some_id").get(0).attributes, function(i, attrib) {
// set each attribute to the specific value
$(new_element).attr(attrib.name, attrib.value);
});
// carry over the html content
new_element.html($("#some_id").html());
// finally, swap the elements
$("#some_id").replaceWith(new_element);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…