JSFiddle - React, Tailwind, and code Playground

by Mehmet Alp

HTML

<div class="ogrenciBilgi">
        <label id="number">1</label>
        <label id="adsoyad">Opera Ceviznet</label>
        <label><button>Kaydet</button></label>
    </div>
    
    <div class="ogrenciBilgi">
        <label id="number">2</label>
        <label id="adsoyad">Opera Ceviznet</label>
        <label><button>Kaydet</button></label>
    </div>
    
    <div class="ogrenciBilgi">
        <label id="number">3</label>
        <label id="adsoyad">Opera Ceviznet</label>
            <label><button>Kaydet</button></label>
    </div>

    <input type="text" value="">

JavaScript

$(".ogrenciBilgi button").click(function(){
    var tiklananOgrenciNo = $(this).parent().parent().find("#number").text();
    $("input").val(tiklananOgrenciNo);
});