Nathan S Nathan S - 1 year ago 72
Javascript Question

equivalent to {'display': ''} within stylesheet

Within Javascript I am able to make a div (a rectangle with a solid border), set its display to none, and then change its display setting back to showing itself using {'display': ''}


var overlay = $('<div class="area"></div>')
.css({position: 'absolute', left: l + 'px',
top: t + 'px', border: 'solid', borderColor: 'red', display: 'none' }).

overlay.css({'display': ''});

I want to make a CSS class that sets its elements display's back to their defaults:

<style id="default">.default { display: '';}</style>
<div class="default"></div>

This does not work. Can anyone tell me the correct syntax for this?

Answer Source

$('').click(function() {
$('a.hide').click(function() {
.area {
  position: absolute;
  left: lpx;
  top: 30px;
  display: none;
  width: 50px;
  height: 50px;
  border: 5px solid red;
} {
  display: block;
a {
  display: inline-block;
  margin: 0;
<script src=""></script>
<div class="area"></div>
<a class="show">SHOW</a>
<a class="hide">HIDE</a>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download