JSFiddle - React, Tailwind, and code Playground
HTML
<div>This is a test.</div>
<div>This is a test.</div>
JavaScript
var degreesX = 0;
var degreesY = 0;
function rotate(xAxis) { //Make xAxis a boolean
if (xAxis) {
degreesX+=10;
} else {
degreesY+=10;
}
alert(degreesX + " " + degreesY);
}
$("div:nth-child(1)").click(function() {
rotate(true);
});
$("div:nth-child(2)").click(function() {
rotate(false);
});