'Hide elements of all iframes in php loop
Could someone please help me to hide the elements for all my iframes? Right now the function is only changing my first iframe. Please see my code below.
<script>
function hideIt(){
document.getElementById('iframe').contentWindow.document.getElementById('editor').style.display = 'none';
document.getElementById('iframe').contentWindow.document.getElementById('heading').style.display = 'none';
document.getElementById('iframe').contentWindow.document.getElementById('deltimer').style.display = 'none';
document.getElementById('iframe').contentWindow.document.getElementById('img').style.margin = '20px';}
</script>
<script>window.onload = hideIt;</script>
<?php
$sql = "SELECT distinct journeyid,image FROM comments WHERE uid=2";
$result = $conn->query($sql);
while($row = mysqli_fetch_array($result)){
$url = $row['journeyid'];
$image = $row['image'];
echo "<div class='column'>";
echo "<iframe id='iframe' style='width: 350px; height:400px' src='https://xn--p1aaa84fbaab.net/newjourney.php?journeyid=$url&image=$image'></iframe>
<a href='https://xn--p1aaa84fbaab.net/newjourney.php?journeyid=$url&image=$image'><br>
<button type='submit' style='color:black' class='hbutton' name ='editJourney'>Edit</button></a>
<button type='submit' class='hbutton' name ='forkJourney'>Fork</button>
<button type='submit' class='hbutton' name ='deleteJourney'>Delete</button>
<button type='submit' class='hbutton' name ='shareJourney'>Share</button>
</div>";}?>
</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
