I have also convert the variable s to string but the result is same what to do how to get the value by class.
function myFunction() {
var s = document.getElementsByClassName('clinic-timings-day');
alert(s);
document.getElementById('#mine').innerHTML = s[0].toString();
alert("test2");
}
<body>
<p class="clinic-timings-day">MON, WED</p>
<a onclick="myFunction()">Try it</a>
</body>
Your made few mistakes on your function.
var s = document.getElementsByClassName('clinic-timings-day').innerHTML;
document.getElementById('mine').innerHTML = s[0].toString();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.