Hide Element after div is loaded dynamically

There is a normal procedure in javascript to hide any element based on page load or click event. For eg, when the page is loaded and DOM is built, using the below code snippet, a button is able to hide the element after it is clicked.

$.function($) {
  $("#button").click(function() {

Similarly, an element can be hidden based on some condition when the page is loaded. Eg - consider the below snippet -