I want to create following markup dynamically using jQuery.
Following jQuery code will do the work.
A better way to accomplish the same is presented below.
.end() you can go back one level. And you can use
.end() any number of times to get out of a deeply nested tag.