Like the title says, I am looking for a quick way to write following jQuery code $('.div a') in "plain" JavaScript. I know we can do getElementsByClassName to find .div, but how about finding the link it contains?
Browsers have a native method for accomplishing this:
document.querySelectorAll( ".div a" );
You can retrieve only the first match with querySelector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With