JSFiddle - React, Tailwind, and code Playground

by nosfan1019

HTML

<div class='top'>    
    <div id='fff' class="aaa">
        <input type='text'>
        <input type='text'>
        <input type='text'>
    </div>
    <div id='fff' class="bbb">
        <input type='text'>
        <input type='text'>
        <input type='text'>
    </div>
</div>

CSS

body {
    margin: 50px;
}

.aaa, .bbb {
    margin: 20px 0;
    background: #eee;
    padding: 20px;
}
.nnn {
    border: 1px solid black;
}

JavaScript

$('body').on('mousedown','div', function(e) {
    var foo = $(e.target).closest('div').attr('class');
    
    console.log(foo);

            
    $('.top > div').each(function() {
        $(this).removeClass('nnn');
    });
    
    $(this).closest('div').addClass('nnn');
    
    
    
    
});