I have ran:
let x = document.createElement('iframe');
Result:
<iframe>
</iframe>
-- And
x.src = "https://www.google.com";
Then the result was:
<iframe src="https://www.google.com">
</iframe>
The code for the element to append to:
<p>Test</p>
And everything was fine until I tried to append (
document.querySelector('prg > p').appendChild(x);
): It just said:
Uncaught TypeError: Cannot read property 'appendChild' of null
at <anonymous>:1:36
How can I fix this or set the value to not be null in the code?
Note: I have tried using DIV and SPAN but to no luck.