Convert jQuery function to pure JavaScript


How can I convert the following jQuery function to pure JavaScript? Purpose: so that I will not need to include jQuery file in the header. I tried a couple of things but it didn’t work.

$(function () {
	$('#myiframe').on('load', function () {
		$('#myiframe').contents().find('body').css('height', '2000px');

Hi nayen,

Just hook into the iframe’s onload function:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Iframe Example</title>
    <iframe src="iframe.html" id='myiframe'></iframe>
      var i = document.getElementById("myiframe");
      i.onload = function() { = '2000px';

Hope that helps.

Thank you very much! That worked.