I have made a list by accessing elements from an array randomly(Using JavaScript, used this link Getting a random value from a JavaScript array) and then print them all (in first div). Now in another div I want to access that all elements but I am getting results like LI,BR etc. whatever i mentioned when i appended elements to div.(I used this link Get all elements nested in UL tag )
Here the code is:
<div id="list1" >
<ol id="olMediators">
</ol>
</div>
For random accessing I am using function
function getRandomNumber()
{
var items= ["Mediator 1","Mediator 2","Mediator 3", "Mediator 4","Mediator 5","Mediator 6","Mediator 7","Mediator 8","Mediator 9"];
var newitems=[];
for(var i=0;i<5;i++){
var item = items[Math.floor(Math.random()*items.length)];
$("#olMediators").append('<li>'+item+'</li>'+'<br/>' );
}
}
And for print them to another div I am using jquery (Onclick on button):
$('#getMediators').click(function(){
$('#radioMediators').hide();
var el = document.getElementById("olMediators").getElementsByTagName("*");
for (var i=0; i<el.length; i++) {
alert(el[i].tagName);
}
So what I did wrong?? How can I get these all elements and print them to some other place(In different div)??
Thanks