could someone explain to me why in a page with this code
<ul id="test">
<li>bla</li>
</ul>
if do
alert($("#test").html());
I get the right content but if I do one the followings
alert($("#test li").html());
alert($("#test > li").html());
alert($("#test li:first-child").html());
I get an error in firebug saying
$("#test li").html is not a function
EDIT: jquery is included in fact this thing doesn't make sense, could it be because this code is launched in a function in an ajax "success"?
REST OF THE CODE //right now it doesn't do anything but if I can't select the li i can't continue
$("#add_entry_form").submit(
function(){
//get data
var title = $(this).find("#title").val();
开发者_开发知识库 var body = $("#editor").val();
var type = $(this).find("#type").val();
$.ajax({
type: 'POST',
url: "add_entry.php",
dataType: "json",
data: "title="+encodeURIComponent(title)+"&body="+encodeURIComponent(body)+"&type="+type,
success: function(response){
alert($("#test li").html());
}
});
return false;
}
)
精彩评论