JSFiddle - React, Tailwind, and code Playground

by Divz

HTML

<ul class="name-detail">
    <li>
          <div class="f-c">
                  Am Vivek
        </div>
        <a href="" class="name-getter">
            get my name
        </a>
        <a href="">
            hello
        </a>
    </li>
</ul>

CSS

ul li{
    list-style:none;
    float:none;
}

JavaScript

$(document).ready(function(){

    $('.name-getter') .click(function(){
        var name = $('ul.name-detail li .f-c').text();
        alert(name);
    });

});