Creating a div element in jQuery does a good job on describing how to create and insert an element, however, I wish to create an element with a child element such as <li><a href="abc.html">click</a></li>. The href and text is susceptible to XSS, so I need take steps. I could create the <a> element like:
var href='abc.html',text='click';
jQuery('<a/>', {
href: href,
text: text
}).appendTo('#mySelector');
How do I modify this to include the </li> element?