I'm developing a new project that uses a lot of ul(unordered list) elements and some of this lists sharing the same values, so I want to make a Javascript function to automatize the process by passing a array for the function and returning the HTML for the page. Something like this:
<h1>Test Page</h1>
List fruits:
<script type="text/javascript" charset="utf-8">
var fruits = ["Banana", "Apple", "Pear", "Strawberry", "Lemon"];
do_list(fruits);
</script>
That should generate:
<h1>Test Page</h1>
List fruits:
<ul>
<li>Banana</li>
<li>Apple</li>
<li>Pear</li>
<li>Strawberry</li>
<li>Lemon</li>
</ul>
How to make this?