Using the DOM function we could find the element using class name and then from that search list go to first index and get the required attribute.
document.getElementsByClassName('class_name')[0].getAttribute('id');
Using the DOM function we could find the element using class name and then from that search list go to first index and get the required attribute.
document.getElementsByClassName('class_name')[0].getAttribute('id');