-1

I want to choose the value of an a > href tag within an iframe This page is my code but it does not work.

<script type="text/javascript">
    $('.addl_ads iframe').attr('id', "ads_frame");
     </script> 

     <iframe src="iframe.html" width="468" height="60"></iframe>

       <button onclick="dd()">Try it</button>
    <p id="demo"></p>
<script>
    function dd() {
    var x =  $('#ads_frame').contents().find('body').find('a').find('href');
    document.getElementById("demo").innerHTML = x;
}
    </script>

please help

1 Answers1

0

My problem was solved. I had to try it on local host ! :D