“Iframe Hide Div” Code-Antworten

Iframe Hide Div

<html lang="en">
<head>
  <title>Hide element inside iframe using javascript</title>
</head>
<body>
  <p>Click on the <b>Hide Div</b> button to hide the div element inside the iframe.</p>
  <button onclick="hideDiv()">Hide Div</button>

  <iframe id="iframe-id" src="https://search.3schools.in/p/example.html" style="height:370px;width:100%">      </iframe>

<script>
function hideDiv() {
  var myIframe = document.getElementById("iframe-id");
  var divElement = myIframe.contentWindow.document.querySelector("#div");
  divElement.style.display = "none";
}
</script>
</body>
</html>
Mystic Dev

Verstecke Div in Iframe

$("#myiframe").contents().find("#myContent").hide();
Mystic Dev

html js verstecken oder zeigen iframe

<button id='hideshow'>Link1</button>
<div class="panel">
  <iframe src="linkcodehere" class="content" style="border:0;display:none"></iframe>
  <br/>
  <p class="content" style="display:none;">some stuff</p>
  <p class="content" style="display:none;">more stuff</p>
</div>
<button id="hideshow2">Link2</button>
<div class="panel2">
  <iframe src="linkcodehere2" class="content2" style="border:0; display:none;"></iframe>
  <br/>
  <p class="content2" style="display:none;">some stuff</p>
  <p class="content2" style="display:none;">more stuff</p>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
Nice Narwhal

html js verstecken oder zeigen iframe

$(document).ready(function(){
  $('#hideshow').on('click', function(event) {        
     $('.content').toggle('show');
  });
});
$(document).ready(function(){
  $('#hideshow2').on('click', function(event) {        
     $('.content2').toggle('show');
  });
});
Nice Narwhal

Ähnliche Antworten wie “Iframe Hide Div”

Fragen ähnlich wie “Iframe Hide Div”

Weitere verwandte Antworten zu “Iframe Hide Div” auf HTML

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen