
$(document).on('click', '.delete_item_answer', function () {

    $(this).closest('.item').remove();

});


$(document).on('change', '#chosse_type', function () {

    var type = $(this).val();

    if (type == 'radio') {

        $('#show_div').css('display', 'block');

        var append = `<div class="row item">
                        <div class="col-6">
                            <div class="form-group" id="answer_ar">
                                <input type="text" class="form-control" value="" name="answer_ar[]" required placeholder="الاجابة بالعربي" aria-label="" />
    
                            </div>
                        </div>
                        <div class="col-6">
                            <div class="form-group" id="answer_en">
                                <input type="text" class="form-control" value="" name="answer_en[]" required placeholder="الاجابة بالانجليزي" aria-label="" />
    
                            </div>
                        </div>
                    </div>`;

        $('#append_here_answer').append(append);

    } else {

        $('#show_div').css('display', 'none');

        $('#append_here_answer').html('');

    }

});

$(document).on('click', '#add_item_answer', function () {



    var append = `<div class="row item">
                        <div class="col-5">
                            <div class="form-group" id="answer_ar">
                                <input type="text" class="form-control" value="" name="answer_ar[]" required placeholder="الاجابة بالعربي" aria-label="" />
    
                            </div>
                        </div>
                        <div class="col-5">
                            <div class="form-group" id="answer_en">
                                <input type="text" class="form-control" value="" name="answer_en[]" required placeholder="الاجابة بالانجليزي" aria-label="" />
    
                            </div>
                        </div>
                        <div class="col-2">
                            <div class="form-group" id="dis_answer_en">
    
                                <button class="btn btn-danger btn-block delete_item_answer" type="button"><i class="fa fa-trash"></i></button>
    
                            </div>
                        </div>
                    </div>`;

    $('#append_here_answer').append(append);



});
