use .on()
As your element is added dynamically so it is not present at the time DOM ready or page load.
So you have to use Event Delegation
Syntax
$( elements ).on( events, selector, data, handler );
like this
$(document).on('blur','#list :last-child',function(){
// code here
});
or
$('parentElementPresesntAtDOMready').on('blur','#list :last-child',function(){
// code here
});
Better use
$('#list').on('blur',':last-child',function(){
// code here
});
Update after OP updated Question
$(function () {
$(document).on('blur', '#list li:last-child', function () { //find last child of li:lastchild
var html = "<li><input type='text' name='firstname[]'></li>";
$('#list ul').append(html); //append list item to ul
return false;
});
});
Better Attach Event Handler to Parent element
$(function () {
$('#list').on('blur', 'li:last-child', function () {
var html = "<li><input type='text' name='firstname[]'></li>";
$('#list ul').append(html);
return false;
});
});