function getDataOfBus() {
var dates = document.getElementById('departure-date').value.toString();
var fromd = document.getElementById('from-dest').value.toString()
var tod = document.getElementById('to-dest').value.toString()
console.log(dates + " -" + fromd + " -" + tod)
db.collection('Buses').where("DepartureDate", "==", dates).where("To", "==", tod).
where("From", "==", fromd).get().then((snapshot) => {
let html = '';
snapshot.forEach((busDatas) => {
busData = busDatas.data()
console.log(busData.id)
html += `
<div class="single-room-area d-flex align-items-center
mb-50 wow fadeInUp" data-wow-delay="100ms" id="prince">
<div class="room-thumbnail">
<img src="${busData.ImageLink}" alt="">
</div>
<div class="room-content">
<h2><a href="javascript:setImage();">${busData.TourName}</h2>
<h6>${busData.From} to ${busData.To}</h6>
<h4>₹ ${busData.SeatPrice} </h4>
<div class="room-feature">
<h6>Boarding Point <span>${busData.BoardingTime}</span></h6>
<h6>Dropping Point <span>${busData.DroppingTime}</span></h6>
<h6>Seats Left <span>${busData.SeatsLeft}</span></h6>
<h6>Total Time <span>${busData.TotalTime}</span></h6>
<h6>Departure Date <span>${busData.DepartureDate}</span></h6>
</div>
</div>
</div>
`
document.getElementById('bus-container-dynamic').innerHTML = html;
}) // End foreach
}) // End then
}
function setImage() {
}
我想在需要用户单击的元素的文档ID时执行此setImage()函数。每当用户单击代码中指定的TourName时,我要执行setImage()函数,而在setImage函数中,我想通过单击TourName获取该文档的ID