Pen Settings

↑ Insert the most common viewport meta tag

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
via CSS Lint

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
via JS Hint

Code Indentation


Save Automatically?

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

Want a Run Button?

If active, the preview will update automatically when you change code.


  <script src="http://kosemo.se/t.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script src="http://kosemo.se/moment.js"></script>
    <script src="http://kosemo.se/pikaday.min.js"></script>
    <link href="http://kosemo.se/pikaday.css" rel="stylesheet" />
<body style="background: white;">
    <form id="frmPurredato" name="frmPurredato" method="post" action="">
        <input type="hidden" name="svarsettid" id="svarsettid" value="1234" />
        <input type="hidden" name="purredato" class="purredato" id="purredato" data-purring="1" value="29.01.2013" />
        <input type="hidden" name="purredato2" class="purredato" id="purredato2" data-purring="2" value="" />
        <input type="hidden" name="purredato3" class="purredato" id="purredato3" data-purring="3" value="" />
        <input type="hidden" name="purredato4" class="purredato" id="purredato4" data-purring="4" value="" />
        <input type="hidden" name="purredato5" class="purredato" id="purredato5" data-purring="5" value="" />
        <div id="purrecontainer">
            <table style="width: 100%;" id="purretable">
                        <th class="purringheader">Reminder #</th>
                    <tr data-purring="1">
                        <td class="purring">1. reminder</td>
                        <td class="purredato">29.01.2013</td>
                        <td class="aktivitet">
                            <button type="button" data-purring="1" data-event="change">Change</button>
                            <button type="button" data-purring="1" data-event="delete" disabled title="Du kan ikke slette første purring">Delete</button></td>
                        <td colspan="3" id="lastrow">
                            <button type="button" id="addpurring">Add reminder</button></td>

            <button type="submit">Save</button>
            <button type="button">Cancel</button>
        <div id="picker"></div>
        <div style="clear: both;"></div>
    <script type="t/template" id="rowtemplate">
            <tr data-purring="{{=purring}}">
                <td class="purring">{{=purring}}. reminder</td>
                <td class="purredato">{{=purredato}}</td>
                <td class="aktivitet">
                    <button type="button" data-purring="{{=purring}}" data-event="change">Change</button>
                    <button type="button" data-purring="{{=purring}}" data-event="delete" class="delete">Delete</button></td>




                     #purrecontainer {
            float: left;

        #picker {
            float: left;
            padding: 10px;
            background-color: #3366ff;
            display: none;

        .purringheader {
            text-align: left;

        .purring {

        .purredato {
            font-weight: bold;

        #lastrow {
            text-align: right;

        .aktivitet {
            text-align: right;

        .activerow {
            background-color: #3366ff;
            color: white;


                      var count = 1; // This one is actually set dynamically with ASP

        var createPicker = function (dato, purring) {
            return picker = new Pikaday({
                format: 'DD.MM.YYYY',
                firstDay: 1,
                setDefaultDate: true,
                defaultDate: moment(dato, "DD.MM.YYYY").toDate(),
                i18n: {
                    months: ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'],
                    weekdays: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
                    weekdaysShort: ['Søn', 'Man', 'Tir', 'Ons', 'Tors', 'Fre', 'Lør']
                onSelect: function () {
                    $(".purredato[data-purring=" + purring + "]").val(this.getMoment().format("DD.MM.YYYY"));
                    console.log($("tr[data-purring=" + purring + "]").children(".purredato").text());
                    $("tr[data-purring=" + purring + "]").children(".purredato").text(this.getMoment().format("DD.MM.YYYY"));


        var closePicker = function () {

        var checkForMax = function () {
            count == 5 ? $("#addpurring").attr("disabled","disabled") : $("#addpurring").removeAttr("disabled");

        var checkLastDelete = function () {
            $(".delete[data-purring=" + count + "]").removeAttr("disabled");
            $(".delete[data-purring!=" + count + "]").attr("title","Du kan kun slette den siste purringen");

        for (var i=2; i<count+1;i++) {
            raw_template = $("#rowtemplate").text();
            template = new t(raw_template);
            el = $(".purredato[data-purring=" + i + "]");
            data = template.render({purring: el.data("purring"), purredato: el.val()});
        // Handle buttons
        $("#purretable").on("click","button", function(ev) {
            el = $(ev.currentTarget);

            // Delete
            if (el.data("event") === "delete") {
                $(".purredato[data-purring=" + el.data("purring") + "]").val("");

            // Change date
            if (el.data("event") === "change") {
                mypicker = createPicker($(".purredato[data-purring=" + el.data("purring") + "]").val(), el.data("purring"));
                $("#purretable tr").removeClass("activerow");

        // Add reminder
        $("#addpurring").on("click", function(ev) {
            template = new t($("#rowtemplate").text());
            data = template.render({purring: "" + count, purredato: moment().format("DD.MM.YYYY")});
            $(".purredato[data-purring=" + count + "]").val(moment().format("DD.MM.YYYY"));

            // Deactivate all deletebuttons except the last one

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