Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                



              
            
!

CSS

              
                input {
  width: 350px;
  margin: 4px;
}

div.menu_info {
  display: none;
}
              
            
!

JS

              
                /*
See https://github.com/velesin/jasmine-jquery for more info 
on the excellent jasmine-jquery library.
*/

function showMenuDiv() {
  toggleMenuDiv('on');
}

function hideMenuDiv() {
  toggleMenuDiv('off');
}

function toggleMenuDiv(whichWay) {
  var menuDiv = document.getElementById('1520_1');
  
  switch (whichWay) {
    case 'on':
      menuDiv.style.display = "block";
      break;
    case 'off':
      menuDiv.style.display = "none";
      break;
  }
}

function setUpHTMLFixture() {
  return setFixtures(
     '<div class="menu_info" id="1520_1">'
    +'<label for="menu_name_1520_1">Menu Name: </label>'
    +'<input name="menu_name_1520_1" id="menu_name_1520_1" type="text" value="Menu 1"><br/>'
    +'<label for="menu_url_1520_1">Source URL: </label>'
    +'<input name="menu_url_1520_1" id="menu_url_1520_1" type="url" value="http://www.arestaurant.com/menus/dinner.pdf">'
    +'</div>'
    +'<button id="btnShowMenuDiv" type="button" onclick="showMenuDiv()">Show Menu Div</button>&nbsp;&nbsp;'
    +'<button id="btnHideMenuDiv" type="button" onclick="hideMenuDiv()">Hide Menu Div</button>'
  );
}

describe("Button Click Event Tests", function() {
  var fixtures = '', menuDivSelector = 'div#1520_1';
   
  beforeEach(function() {
    fixtures = setUpHTMLFixture();
  });
      
  it ("#btnShowMenuDiv should show the menu div.", function() {
    $('#btnShowMenuDiv').trigger( "click" );
       
    expect(menuDivSelector).toBeVisible();
  });
      
  it ("#btnHideMenuDiv should hide the menu div.", function() {
    $('#btnHideMenuDiv').trigger( "click" );
       
    expect(menuDivSelector).toBeHidden();
  });
});


//this code appends my blurb after the Jasmine report is loaded!
MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
// define a new observer
var obs = new MutationObserver(function(mutations, observer) {
    // look through all mutations that just occured
    for(var i=0; i<mutations.length; ++i) {
        // look through all added nodes of this mutation
        for(var j=0; j<mutations[i].addedNodes.length; ++j) {
            var addedNode = mutations[i].addedNodes[j];
            if(addedNode.className == "jasmine_html-reporter") {
                $(addedNode).after(
                  $('<br>'),
                  $('<p>')
                    .css("text-align", "left")
                      .html('If you found this demo useful, consider helping out this struggling writer by '
                           +'<a href="https://www.paypal.me/RobertGravelle/1" target="_blank">donating $1 dollar</a> '
                           +'(secure PayPal link) for a coffee or purchasing one of my songs from '
                           +'<a href="https://ax.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?term=rob%20gravelle" target="_blank">'
                           +'iTunes.com</a> or <a href="http://www.amazon.com/s/ref=ntt_srch_drd_B001ES9TTK?ie=UTF8&'
                           +'field-keywords=Rob%20Gravelle&index=digital-music&search-type=ss" target="_blank">'
                           +'Amazon.com</a> for only 0.99 cents each.</p>'),
                  $('<p>')
                    .css("text-align", "left")
                      .html('Rob uses and recommends <a href="http://www.mochahost.com/2425.html" target="_blank">MochaHost</a>,'
                           +' which provides Web Hosting for as low as $1.95 per month, as well as unlimited emails and disk space!')
                 );
            }
        }
    }
});

// have the observer observe foo for changes in children
obs.observe(document.body, {
  childList: true
});



              
            
!
999px

Console