JSFiddle - React, Tailwind, and code Playground

HTML

<title>addClass demo</title>
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
 
<p>Hello</p>
<p>and</p>
<p>Goodbye</p>
    
  
<div class="A"></div>

<div class="B"></div>

CSS

p {
    margin: 8px;
    font-size: 16px;
  }
  .selected {
    color: blue;
  }
  .highlight {
    background: yellow;
  }


.A{
	width:50px;
	height:50px;
	background-color:#000000;
}

.B{
	width:100px;
	height:100px;
	background-color:#FF0004;
}

.C{
	width:150px;
	height:150px;
	background-color:#12FF00;
}

JavaScript

$( "p" ).last().addClass( "selected" );

var test = document.GetElementsByclassName('A'),
    test2 = document.GetElementsByclassName('B'),

test.onclick = function(){
  test2.document.GetElementsByclassName('C');
}