Smart UI Components & Libraries – Grid, Scheduler, Gantt, Kanban for Angular, React, Next.js, Vue, Blazor, JavaScript › Forums › General Discussions › Card View › card click event › Reply To: card click event
September 14, 2021 at 5:50 am
#102202
Keymaster
Hi Dark Beccio,
You can achieve that with the following code:
window.onload = () => { const cardview = document.querySelector('smart-card-view'); const cards = cardview.querySelectorAll('smart-card'); for(let i = 0; i < cards.length; i++) { cards[i].onclick = () => { alert("click"); } }}
In the above code we get all smart-card instances inside the card view and add click event handler to them.
Hope this helps.
Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/