Bug 16148: Add preventDefault to avoid the scrollbar to move to the top
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 6 Jun 2016 13:43:37 +0000 (14:43 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 17 Jun 2016 16:11:43 +0000 (16:11 +0000)
.. when click on buttons

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js

index 3c1be0b..31ea7f7 100644 (file)
@@ -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();
     });