Side navigation
#7077 closed bug (invalid)
Opened September 24, 2010 04:29PM UTC
Closed September 24, 2010 05:41PM UTC
.find not working with first element
Reported by: | ScaredyCat | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.3 |
Component: | core | Version: | 1.4.2 |
Keywords: | find ajax | Cc: | |
Blocked by: | Blocking: |
Description
.find doesn't appear to work if the searched for element is the first element it encounters.
Assume I have a page with a table on it that has an id of 'cheese', I want to make an ajax call to replace the table.
If I return:
<table id='cheese'><tr><td>Something</td></tr></table>
from an ajax call
$.ajax({
type: 'GET,
url: 'something.php',
dataType: "html",
success: function(data) {
var $response=$(data);
var ourdata = $response.find('#cheese');
$('#cheese').replaceWith(ourdata);
});
jQuery doesn't find the table. If I wrap the table in, for example
<div id='fake'>
<table id='cheese'><tr><td>Something</td></tr></table>
</div>
jQuery will find it.
Attachments (0)
Change History (1)
Changed September 24, 2010 05:41PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
You want
.filter
, not.find
. In the future, please use the jQuery Forum for support requests.