Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72358

Get InnerHTML from span with same class name [duplicate]

$
0
0

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


Viewing all articles
Browse latest Browse all 72358

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>