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!
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!
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="/"; };
Source: https://ru.stackoverflow.com/questions/280389/
All Articles