V
V
Victor Umansky2021-06-29 18:27:00
JavaScript
Victor Umansky, 2021-06-29 18:27:00

After clicking on the input radio li should hide?

Hello everyone, I'm doing a to-do task, there is a task list with an input radio, after clicking it should be deleted, that is, the abyss of the list (the task itself is successfully deleted), I can't execute the jquery part.

Example:
I delete some task, the div hides the block, and when I delete it again, alas, the deletion does not happen ???

<li class="list-group-item task" id="<?= $res['id'] ?>">
    <input type="radio" name="radioTask" class="radioTask" value="<?= $res['id'] ?>">
    <label>
        <span class="list-task"><?= $res['task'] ?></span>
    </label>
</li>


// это часть отправляет value значение в PHP
  $(".radioTask").click(function () {
        var val = $(".radioTask:checked").val();
        $.ajax({
            type: "GET",
            url: "ajax.php",
            data: {val: val},
        });

// а вот это часть скрывает div#task блок
        $("#task").css({
            display: "none",
            visibility: "hidden"
        });
    });

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Victor Umansky, 2021-07-07
@Uman

As I was told

$(".radioTask").click(function () {
        var val = $(".radioTask:checked").val();
        $.ajax({
            type: "GET",
            url: "",
            data: {val: val},
        });
        $('.task').click(function(){
            $(this).remove();
        });
    });

A
Alekosh Akhosh, 2021-06-29
@Akhosh

Visibility: "hidden" hides your div

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question