<script src="https://cdn.rawgit.com/amasad/DOMQL/master/domql.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<style>
body,span{
padding: 10px
}
input {
margin: 10px
}
ol {
border: solid 1px gray;
min-height:100px;
margin: 10px;
}
</style>
</head>
<body>
<div id="container"></div>
<!-- Generate main view -->
<script type="text/domql">
INSERT INTO (SELECT DIV FROM BODY WHERE ID='container') VALUES (
CREATE ELEMENT h2 (
innerText 'TODOS:'
),
CREATE ELEMENT SPAN (
innerText 'Count: 0',
id 'count'
),
CREATE ELEMENT OL (
class 'list'
)
);
INSERT INTO (SELECT DIV FROM BODY WHERE ID='container') VALUES (
CREATE ELEMENT LABEL (
innerHTML 'Controls:'
),
INSERT INTO (CREATE ELEMENT DIV(class 'controls')) VALUES (
CREATE ELEMENT LABEL (
innerHTML 'TODO:'
),
CREATE ELEMENT INPUT (
id 'input-name',
type 'text'
),
CREATE ELEMENT LABEL (
innerHTML 'Time:'
),
CREATE ELEMENT INPUT (
id 'input-time',
type 'text'
),
CREATE ELEMENT INPUT (
type 'submit',
value 'add',
onclick 'DOMQL.tmpl("add-list-item",
DOMQL.tmpl("get-input", "input-name"),
DOMQL.tmpl("get-input", "input-time")
)
DOMQL.tmpl("update-count", DOMQL.tmpl("get-count"))'
),
CREATE ELEMENT BR(),
CREATE ELEMENT INPUT (
type 'submit',
value 'delete all',
onclick 'DOMQL.tmpl("delete-all")
DOMQL.tmpl("update-count",...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.