How to use the jquery .load() function to return the innerHTML of an element
JQuery
Assume this works: $('table td').load('/my/url/ div p');
I would end up with <td><p>Some Text</p></td>
I want to end up with 开发者_如何学Go<td>Some Text</td>
How would I do that?
Select all immediate children of the p:
$('table td').load('/my/url/ div p > *');
You probably need to use a callback function. Something like:
$('table td').load('/my/url/ div p', function () {
$(this).find("p").replaceWith($(this).text());
});
var el = $('table td').load('/my/url/ div p', function() {
var $this = $(this);
$this.html($this.find('p').html());
});
精彩评论