JSFiddle - React, Tailwind, and code Playground

by neerajdotname

HTML

<div>
    <label for="name">Name</label> 
    <input class="required" type="text" name="name" id="name" />
    <span>*</span>
</div>    
    
<div>
  <label for="email">Email</label> 
  <input type="text" name="email" id="email" />
</div>

CSS

div { margin: 10px;}
.gender label { margin-right: 10px;}

.highlight { background: yellow;}

JavaScript

//
// replace asterik with required word
//
$('input.required').parent().find('span').css({color: 'red'}).text('(required)');