Hello! I have two divas!

<div id="button"><div> <div id="main"><iframe src="" width="" height="" ></iframe></div> 

How to make it so that when you click on a button , the src in the iframe second div changes? Thank you in advance!

    1 answer 1

    http://jsfiddle.net/ReinRaus/vTX9A/
    jQuery

     $('#button').on('click', function() { $('#main iframe')[0].src= '/'; }); 

    pureJS

     var button2= document.getElementById('button2'); button2.onclick= function() { document.getElementById('main').getElementsByTagName('iframe')[0].src="/"; }; 
    • You are super!!! - DOsS