After the first block of code, you end up with:
<input name="checkboxSelected" type="checkbox" />
<span class="MediaItemDescription"><i>List Item 1
<input type="text" id="duration" name="duration" onkeyup="saveDur(this, 1)" value="Duration 1" />
<div style="clear: both"></div>
One of the divs isn't closed off, so you'll want to tidy that up.
Would you find the onkeyup if you used #duration instead of #dur
Also, if it's a loop where multiple list items will be created, you should know that id attributes must be unique. If they're used for styling, then class names can be more appropriate. If they're there to help you find things, there are other solutions that you should use instead.