$(document).ready(function(){ /* $('.check-customWork').on('change', function(e){ $target = $(e.target); console.log('switch'); })*/ var populate = $("#populate"); $('.delete-article').on('click',function(e){ $target = $(e.target); //console.log($target.attr('data-id')); const id = $target.attr('data-id'); $.ajax({ type: 'DELETE', url: '/articles/A/'+id, success: function(response){ alert('Deleting Article'); window.location.href='/'; }, error: function(err){ console.log(err); } }); }); // Kép Törlése var populate = $("#populate"); $('.delete-file').on('click',function(e){ $target = $(e.target); //console.log($target.attr('data-id')); const fn = $target.attr('file-name'); const fp = $target.attr('file-path'); $.ajax({ type: 'DELETE', url: '/articles/F/'+fn, success: function(response){ alert('Deleting Article'); window.location.href='/'; }, error: function(err){ console.log(err); } }); }); //}); // Get the form fields and hidden div // Get the form fields and hidden div var checkbox = $("#Arc"); // Setup an event listener for when the state of the // checkbox changes. checkbox.change(function() { // Check to see if the checkbox is checked. // If it is, show the fields and populate the input. // If not, hide the fields. if (checkbox.is(':checked')) { // Show the hidden fields. console.log('checked'); // Populate the input. //s document.getElementById("populate").readOnly = true; populate.val("EMSZ"); } else { // Make sure that the hidden fields are indeed // hidden. document.getElementById("populate").value ="----"; } }); });