To change an html element e.g. from <a>.....</a> to <span>.....</span> you can use the replaceWith() function of jQuery.
For an element
<a class='sample' href='http://www.google.com' id='thelink' >Click this</a>
to convert to span
<span .....>Click this</span>
use the following jQuery snippet
<script>
$(document).ready(function() {
var str = '';
$("#thelink").replaceWith(function(){
str += ' class = '+ $(this).attr('class');
str += ' id = '+ $(this).attr('id');
str += ' href = '+ $(this).attr('href');
return $("<span "+str+">" + $(this).html() + "</span>");
});
});
</script>
For an element
<a class='sample' href='http://www.google.com' id='thelink' >Click this</a>
to convert to span
<span .....>Click this</span>
use the following jQuery snippet
<script>
$(document).ready(function() {
var str = '';
$("#thelink").replaceWith(function(){
str += ' class = '+ $(this).attr('class');
str += ' id = '+ $(this).attr('id');
str += ' href = '+ $(this).attr('href');
return $("<span "+str+">" + $(this).html() + "</span>");
});
});
</script>