$(document).ready(function () {
  $("#printButton").click(() => {
    // answer & question

    let answer3 = $("#floatingTextarea3").val().replace(/\n/g, "<br>");

    //let question = $("#questionLabel").text();

    document.body.innerHTML = `ΑΠΑΝΤΗΣΗ:  
          <div class="d-flex justify-content-evenly">
            <p>

			
			<br/>${answer3}
			
			</p>
			
          </div>`;
    // print
    window.print();
    // reload page
    window.location.reload();
  });

  $(window).resize();

  /*CUSTOM SCRIPT FOR INPUT MODAL POPUP*/
  var currentInput = null; // Variable to hold the current input reference

  // Trigger modal and save the current input reference
  $(".input-modal-trigger").click(function () {
    currentInput = $(this); // Save reference to the current input field
    $("#modalInput").val(currentInput.val());
    $("#inputModal").modal("show");
  });

  // On saving changes in modal
  $("#saveModalInput")
    .off("click")
    .on("click", function () {
      if (currentInput) {
        currentInput.val($("#modalInput").val()); // Update the current input field
        $("#inputModal").modal("hide");
        currentInput = null; // Clear the reference
      }
    });
});
