If I run $('<span>foo</span>').insertAfter('p') and there are for example 2 <p>s, it will insert 2 <span>s. But the return value of the code is only the first <span>. So if I want to chain an onclick handler after that, it only gets bound to the first <span> not all the inserted ones. Is that normal? Is there a better way to do it?
See example at http://jsbin.com/eyuwo and look at the firebug console output.