This question already has an answer here:
I would ask for help because I'm not familiar with JavaScript, so I don't know where to start.
Anyway, I wish to get inner text or inner html from div with same class name "title".here is my HTML code. i wish to display all text from "title" div into "results"
<div class="room-info">
<div class="title">Super Deluxe Double / Twin Room</div>
<div class="sub-title">Max1people</div>
</div>
<div class="room-info">
<div class="title">Super Deluxe Double / Twin Room</div>
<div class="sub-title">Max1people</div>
</div>
<div class="results"></div>
Here is my Javascript,but its not work,dont know why.
function SearchFunction() {
var z1 = document.getElementsByClassName("title");
var z2 = document.getElementsByClassName("results");
z2.value = z1.innerHTML ;
}
Thank you for any solution to my problem