bsb_coffee
bsb_coffee

Reputation: 7061

Javascript - HTMLCollection to string using prototype

Hi I am trying to update a div with some html from another div.

var results = document.getElementsByClassName("myclass");
$("resultsDiv").update(results);

I then get this: [object HTMLCollection] How do I convert it to a string so it is shown as html in my div ?

Cheers

Upvotes: 0

Views: 3466

Answers (1)

Gordon Gustafson
Gordon Gustafson

Reputation: 41229

you can just copy and paste the innerhtml.

var data = div1.innerHTML;
div2.innerHTML=data;

otherwise you have to deal with all the altering of DOM nodes,

Upvotes: 2

Related Questions