I have the following string
"<iframe width="420" height="315" src="https://www.youtube.com/embed/DgPO56ImqUA?showinfo=1" frameborder="0" allowfullscreen></iframe>".
how can i get the value of src using javascript.
I have the following string
"<iframe width="420" height="315" src="https://www.youtube.com/embed/DgPO56ImqUA?showinfo=1" frameborder="0" allowfullscreen></iframe>".
how can i get the value of src using javascript.
You can use a regular expression to pull the src
from your string like so:
var myString = '<iframe width="420" height="315" src="https://www.youtube.com/embed/DgPO56ImqUA?showinfo=1" frameborder="0" allowfullscreen></iframe>';
var regex = /<iframe.*?src="(.*?)"/;
var src = regex.exec(myString)[1];
console.log(src);
Give a name to your frame such as
"name="frame1" width=..... />"
then use this alert(document.frames['frame1'].location.href);