<div id="dinamico" class="row">
<div class="col-12">
<iframe class="test" src="https://www.navexterno.com" min-height="70px" width="100%" frameborder="none"></iframe>
</div>
</div>
This iFrame
contains a menu with 2 links, within the tags nav
, ul
, li
are my links, which are:
<a id="enlace1" href="google.com">Google</a>
<a id="enlace2" href="youtube.com">Youtube</a>
And in my place where the iFrame
is placed, I have these links
<a id="enlace-dinamico1" href="#">Google</a>
<a id="enlace-dinamico2" href="#">Youtube</a>
Now I would like to know how I can get the links 1 and 2 (href)
that are inside the iframe
and assign them to the dynamic links 1 and 2 that are in the static site.
I tried :
var enlace-d = $("#enlace1").attr("href");
Also try :
var anchor = document.getElementById("enlace1");
var href_val = anchor.getAttribute("href");
And also do not select the link.