jeudi 16 août 2018

Django | Dynamic textfield show depends on selected checkbox

I want to show specific textfield next to checkbox, but my id's and values of checkbox is dynamic from table fields. If i click checkbox "id" i want to show "id" textfield.

How it looks like

My template

<legend>Choose columns to show:</legend>
            

My JS

$(function () {
            $('input[name="contains"]').hide();


            $('input[name="column"]').on('click', function () {
                if ($(this).is(':checked')) {
                    //alert($(this).val())
                    $('input[name="contains"]').fadeIn()
                } else {
                    $('input[name="contains"]').fadeOut()
                }
             })
            })

My code showing all of the textfields, but i dont know how to show specific one.




Aucun commentaire:

Enregistrer un commentaire