JSFiddle - React, Tailwind, and code Playground

by Greg Schudel

HTML

<body>

<div class="grid">
    <div id="quiz" style="float:left;">
        <h1>Warrior</h1>

        <h2 id="question" class="headline-secondary--grouped"></h2>

        <br>
        <button id="attack_high" onclick="attack_high" class="btn--default">head</button>

        <br>
        <button id="attack_low" onclick="attack_low" class="btn--default">legs</button>

        <footer>
            <p id="goodguy_health">Temp Health</p>
        </footer>
    </div>

    <div id="quiz" style="float:right;">
        <h1>Monster</h1>

        <h2 id="question" class="headline-secondary--grouped"></h2>

        <br>
        <button id="attack_high" onclick="attack_high" class="btn--default">head</button>

        <br>
        <button id="attack_low" onclick="attack_low" class="btn--default">legs</button>

        <footer>
            <p id="badguy_health">Temp Health</p>
        </footer>
    </div>




</div>

<script src="quiz.js"></script>
<script src="question.js"></script>
<script src="quiz_ui.js"></script>
<script src="app.js"></script>
</body>

CSS

@import url("http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900");
.grid:after {
  content: "";
  display: table;
  clear: both; }

.srt, .form__label--hidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px; }

.panel--centered, .panel--padded--centered, [class^="btn--"] {
  text-align: center; }

[class^="progbar__"]:after, .icn--nav-toggle:before {
  display: block;
  content: '';
  position: absolute; }

.centered, .grid {
  float: none;
  margin-left: auto;
  margin-right: auto; }

html {
  font-family: sans-serif;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-top: 2.5em; }

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
  display: block; }

audio,
canvas,
progress,
video {
  display: inline-block;
  vertical-align: baseline; }

audio:not([controls]) {
  display: none;
  height: 0; }

[hidden],
template {
  display: none; }

a {
  background: transparent; }

a:active,
a:hover {
  outline: 0; }

abbr[title] {
  border-bottom: 1px dotted; }

b,
strong {
  font-weight: bold; }

dfn {
  font-style: italic; }

h1 {
  font-size: 2em;
  margin: 0.67em 0; }

mark {
  background: #ff0;
  color: #000; }

small {
  font-size: 80%; }

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline; }

sup {
  top: -0.5em; }

sub {
  bottom: -0.25em; }

img {
  border: 0; }

svg:not(:root) {
  overflow: hidden; }

figure {
  margin: 1em 40px; }

hr {
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  height: 0; }

pre {
  overflow: auto; }

code,
kbd,
pre,
samp {
  font-family: monospace, monospace;
  font-size: 1em; }

button,
input,
optgroup,
select,
textarea {
  color: inherit;
  font: inherit;
  margin: 0; }

button {
  overflow: visible; }

button,
select {
  text-transform: none; }

button,
html...

JavaScript

function goodGuyHealth (health){

	this.health= 100;

}

goodGuyHealth.prototype.attack_high = function(){
	this.health -= 50;

}


goodGuyHealth.prototype.attack_low = function(){
	this.health -= 10;

}




function myFunction() {

	if (onclick) {
    let whenAttacked -= document.getElementById("attack_high").innerHTML;

	}else {
    let whenAttacked -= document.getElementById("attack_high").innerHTML;
	};
	
    //somehow display code in 'Temp Health section'
}