Warum funktioniert das hier nicht: Wieso passiert da nichts?
// die seite mit iframe
//mein iframe inhalt
// die seite mit iframe
Code:
<!doctype html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript">
$().ready(function () {
$("#iframe").ready(function () { //The function below executes once the iframe has finished loading
$("#iframe").contents().find("body").append('<div class="ab"></div>');
});
});
</script>
</head>
<body>
<iframe id="iframe" src="/iframe"></iframe>
</body>
</html>
Code:
<!doctype html>
<html>
<head>
<style>
.hidden { display:none;}
.ab { width:100px;height:100px;background-color:blue;border:1px solid black;}
</style>
</head>
<body>
<div class="hidden">
<input type="button" cless="abc" value="ABCD"></input>
</div>
</body>
</html>
Zuletzt bearbeitet: