Skip to content

Instantly share code, notes, and snippets.

@jens1101
Created October 11, 2016 11:48
Show Gist options
  • Select an option

  • Save jens1101/130d329f4923d2adb4e9918210e57294 to your computer and use it in GitHub Desktop.

Select an option

Save jens1101/130d329f4923d2adb4e9918210e57294 to your computer and use it in GitHub Desktop.
Set iframe contents via jQuery
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<iframe></iframe>
<button class="btn btn-primary">This is not a bootstrap button</button>
<script src="script.js"></script>
</body>
</html>
$('iframe').contents().find('html').load('./test.html');
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" />
</head>
<body>
<div class="container">
<button class="btn btn-primary">This is a bootstrap button</button>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment