JSFiddle - React, Tailwind, and code Playground
by Dineshkani
HTML
<div id="firstdiv" class="sample">
Hello Jquery
</div>
<div id="secondiv">
Hello Javascript
</div>
CSS
.hello{
color: red;
}
.hai{
color: blue;
}
JavaScript
//jquery
//Syntax: .attr("attrname","appliedvalue");
$("#firstdiv").attr('class',"hello"); //sets the attribute class from sample to hello if the attribute not exists then puts the new attribute
//Javascript
document.getElementById("secondiv").setAttribute("class","hai"); //sets the attribute class as hai if the attribute not exists then puts the new attribute.
//You can compare the flexibility of the both Javascript and Jquery in here.