Refactor - generate markup with jQuery