tags:

views:

31

answers:

3

I'd like to get rid of all links in a specific div tag with the help of jquery.

E.g from this:

<div id="some_div">
    <a href="whatever.html">click here</a>
</div>

To this:

<div id="some_div">
    click here
</div>

Thanks in advance.

+2  A: 
var textToReplace = $("#some_div a").text();
$("#some_div").text(textToReplace);
rahul
A: 
$('#some_div').text($('#some_div').text());
Matt Dearing
+2  A: 

As of 1.4, you can use $.unwrap():

$("#some_div a").contents().unwrap();

Online Demo: http://jsbin.com/otobu/edit

Jonathan Sampson