How to adjust the height of iframe based on the loaded content using jQuery?

To adjust the height of iframe, use the jQuery height() method. You can try to run the following code to adjust height of iframe dynamically on button click:


Live Demo

<!DOCTYPE html>
    <script src=""></script>
  <iframe src="" style="height:150px;width:400px;border:2px solid gray;background-color:lightblue;"></iframe><br>
  <button>Change Height</button>