for(var i = 0; i < mutation.addedNodes.length; i++) {
var inputs = mutation.addedNodes[i];
console.log(inputs);
}
I want to apply querySelectorAll() on inputs but it is throwing an error
Uncaught TypeError: mutation.addedNodes[i].querySelectorAll is not a function.
but it is throwing an error Uncaught TypeError: mutation.addedNodes[i].querySelectorAll is not a function.
querySelectorAll is invoked on an Element
(doesn't include TextNode), just check if mutation.addedNodes[i]
is an Element
or not.
for(var i = 0; i < mutation.addedNodes.length; i++)
{
var ele = mutation.addedNodes[i];
if ( ele instanceof Element )
{
ele.querySelectorAll( "*" ); //put your selector
}
}