Member 13702607 Ответов: 1

Как отобразить данные в div с помощью jquery, когда есть несколько флажков?


<input type="checkbox" class="filled-in" id="checkbox31">
<label for="checkbox31" class="justify-content" style="font-weight:bold; font-size: 0.9rem;">DISCONNECT/PO CANCEL REASONS</label>
<div class="float-left">
<textarea name="Text1" cols="40" rows="4"></textarea>
</div>
<input type="checkbox" class="filled-in" id="checkbox3">
<label for="checkbox3" class="justify-content" style="font-weight:bold; font-size: 0.9rem;">REP USED REASON</label>

<div class="float-left">
<textarea name="Text1" cols="40" rows="4"></textarea>
</div>
<input type="checkbox" class="filled-in" id="checkbox3" onclick="myFunction()">
<label for="checkbox3" class="justify-content" style="font-weight:bold; font-size: 0.9rem;">CUSTOMER OBJECTION</label>

<div class="float-left">
<textarea name="Text1" cols="40" rows="4"></textarea>
</div>



<div id="autoUpdate" style="display:none">
<input type="checkbox" class="filled-in" id="checkbox301">
<label for="checkbox301" class="label-table"></label>
    <label for="input15" class="col-sm-9 col-form-label pt-2">Promotion discontinued</label>
<br />
<input type="checkbox" class="filled-in" id="checkbox301">
<label for="checkbox301" class="label-table"></label>
    <label for="input15" class="col-sm-9 col-form-label pt-2">Abonded service</label>
<br />
</div>

<div id="Reason2" style="display:none">
<label for="input15" class="col-sm-9 col-form-label pt-2">Reason l</label>
<label for="input15" class="col-sm-9 col-form-label pt-2">Reason 2</label>
<label for="input15" class="col-sm-9 col-form-label pt-2">Reason 3</label>
</div>
[![Please refer the image the check box needs to display code as as in the checkbox][1]][1]

Below is the jquery function

    $(document).ready(function ()

    {

    $('#checkbox31').change(function () 

    {
    if (this.checked)

    $('#autoUpdate').fadeIn('slow');

    else

    $('#autoUpdate').fadeOut('slow');

    });

    });


Что я уже пробовал:

I am trying to display data using jquery when check box is checked. I am to get the data for a single check box but i need to display data differently for each check box. Below is the code for html and jquery


Can anyone help me to create a function which can capture the ids of other check boxes to display data when check box is checked? I'm new to jqueryenter code here

Member 12810461

можете ли вы поделиться тем, что вы хотите показать при проверке какого флажка?

1 Ответов

Рейтинг:
2

Chirag Sudra

Я прошел через ваш флажок кода с идентификатором

#checkbox31
отсутствовать.
Используйте правильный идентификатор флажка в функции jquery.

Это будет работать идеально.


Richard Deeming

- Вы уверены?

<input type="checkbox" class="filled-in" id="checkbox31">

Первая строка блока кода.

Chirag Sudra

Да. он будет работать так же, как я пробовал то же самое с вашим кодом.