.html() can put an id inside and use it

.html() can put an id inside and use it

I have a id inside the .html(<div id="foo"></div>). I trying to use the id to call a function. is suppose to work?