document.querySelectorAll
returns a nodelist, not a single HTML element, so it has no method querySelectorAll
. In other words, you can't chain querySelectorAll
method calls.
But then you've no need to; just modify your selector:
document.querySelectorAll('iframe[data-key="'+key+'"]');
For more complex purposes, where more computation is needed and merely extending the selector is not an option, you can harness array.prototype.filter
[].filter.call(document.querySelectorAll('[data-key="'+key+'"]'), function(el) {
return el.tagName == 'iframe';
});