cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

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.

              <div class="container">

    A simple counter implemented with <a href="https://meiosis.js.org" target="_blank">Meiosis</a> and <a href="https://jquery.com" target="_blank">jQuery</a>.

    Explanations are in the <a href="https://foxdonut.gitbooks.io/meiosis-guide/content/counter_example_with_jquery.html" target="_blank">Meiosis Guide</a>. You will also find the source code in the <a href="https://github.com/foxdonut/meiosis-examples/tree/master/examples/counter" target="_blank">meiosis-examples</a> repository.

  <div id="app"></div>

              var initialModel = { counter: 0 };

var view = function(model) {
  return "<div><span>Counter: " + model.counter + "</span></div>" +
    "<div><button id='inc' class='btn btn-default'>+ 1</button> <button id='decr' class='btn btn-default'>- 1</button></div>";

var receive = function(model, proposal) {
  return { counter: model.counter + proposal.add };

var ready = function(propose) {
  var $root = $(document.getElementById("app"));

  $root.on("click", "button#inc", function(_evt) {
    propose({ add: 1 });
  $root.on("click", "button#decr", function(_evt) {
    propose({ add: -1 });

var renderer = meiosisVanillaJs.renderer();

var Main = meiosis.createComponent({
  view: view,
  ready: ready,
  receive: receive

  renderer: renderer.intoId(document, "app"),
  initialModel: initialModel,
  rootComponent: Main

Loading ..................