JSFiddle - React, Tailwind, and code Playground

by dandv

CSS

.red {
    color: red;
}

JavaScript

$("<a>link 1</a>").attr({href: "http://link1.com", class: "red"}).appendTo("body");  // works as expected
    
$("<a>link 2</a>", {href: "http://api.jquery.com/jQuery/", class: "red"}).appendTo("body");  // doesn't create any attributes

$("<a>", {text: "link 3", href: "http://api.jquery.com/jQuery/", class: "red"}).appendTo("body");  // works as expected