From 2651fc9b8defd0455061f442b30b115d1ea614df Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 6 Jun 2016 14:43:37 +0100 Subject: [PATCH] Bug 16148: Add preventDefault to avoid the scrollbar to move to the top .. when click on buttons Signed-off-by: Jonathan Druart --- .../intranet-tmpl/prog/js/marc_modification_templates.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js b/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js index 3c1be0b..31ea7f7 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js +++ b/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js @@ -47,23 +47,27 @@ $(document).ready(function() { updateAllEvery(); }); - $("#new_action").on("click",function(){ + $("#new_action").on("click",function(e){ + e.preventDefault(); cancelEditAction(); $("#add_action").show(); $("#action").focus(); }); - $(".duplicate_template").on("click",function(){ + $(".duplicate_template").on("click",function(e){ + e.preventDefault(); var template_id = $(this).data("template_id"); $("#duplicate_a_template").val(template_id); $("#duplicate_current_template").val(1); }); - $('#createTemplate').on('shown', function () { + $('#createTemplate').on('shown', function (e) { + e.preventDefault(); $("#template_name").focus(); }); - $("#duplicate_a_template").on("change",function(){ + $("#duplicate_a_template").on("change",function(e){ + e.preventDefault(); if( this.value == '' ){ $("#duplicate_current_template").val(""); } else { @@ -71,7 +75,8 @@ $(document).ready(function() { } }); - $(".delete_template").on("click",function(){ + $(".delete_template").on("click",function(e){ + e.preventDefault(); return confirmDelete(); }); -- 2.8.1