Show element

Description

The following code shows how to show element.

Example


<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#message {<!-- www  . j av  a  2 s  .com-->
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 20px;
  background-color: orange;
}

#container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 500px;
}
</style>
<script
  src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
  $(function() {
    $("#message").click(function(e) {
      e.stopPropagation();
      $(this).hide();
    });
    $(document).click(function() {
      $("#message").show();
    });
  });
</script>
</head>
<body>
  <div id="message">This is a message.</div>
</body>
</html>

Click to view the demo





















Home »
  jQuery »
    jQuery Example »




Animation
DOM
Event
Form
List
Select
Style
Table
Utilities