im trying to make a button that once click will make it so that the same javascript code would apply to the same class but it wont work
function Destination() {
hrs = Math.round(Math.random() * 12);
mins = Math.round(Math.random() * 60);
var hFormat = (hrs < 10 ? "0" : "");
var mFormat = (mins < 10 ? "0" : "");
var amPm = (hrs < 12 ? "AM" : "PM");
return String(hFormat + hrs + ":" + mFormat + mins + " " + amPm);
}
<button onclick="document.getElementsByClassName('AirAsiaTable1').innerHTML =Destination(12,60)">
<i class="fas fa-search"></i>
</button>