Показать сообщение отдельно
  #2 (permalink)  
Старый 20.08.2022, 08:15
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,070

vasoli,
<!DOCTYPE html>
<html>

<head>
    <title>Untitled</title>
    <meta charset="utf-8">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script>
        $(function() {
            $('.table_td').on('change', 'input:checkbox', function(event) {
                $('#options_value').html('');
                $('input:checkbox:checked', event.delegateTarget).each(function() {
                    //let txt = $(`[for="${this.id}"]`).text();
                    let txt = this.labels[0].textContent;
                    $('#options_value').append([txt, this.value] + '<br>');
                });
            });
        });
    </script>
</head>

<body>
    <div class="sum_value">
        <div class="table_td">
            <input type="checkbox" value="vvv" id="table_td" placeholder="1">
            <label for="table_td" type="checkbox" id="table_td">texto for label</label>
            <noscript>BBB</noscript>
        </div>
        <div class="res1">
            <div class="options_sum" id="options_sum">x: <span></span></div>
            <div class="options_value" id="options_value">
                <p id="options_value" class="options_value"></p>
            </div>
        </div>
    </div>
</body>

</html>
Ответить с цитированием