From c7c51f89dbcf419c61f264de13933bfa9f1c51fb Mon Sep 17 00:00:00 2001 From: Bozhidar Gyurov Date: Mon, 18 May 2020 13:06:37 +0300 Subject: [PATCH] Check if url attr is present --- web/js/general.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/web/js/general.js b/web/js/general.js index 6f25098..a96c296 100644 --- a/web/js/general.js +++ b/web/js/general.js @@ -93,13 +93,17 @@ $(function(){ $('body').on('click', '[data-toggle="modal"]', function(e) { e.preventDefault(); - var url = $(this).attr('href'); - if (url.indexOf('#') === 0) { - $(url).modal('open'); - } else { - $.get(url, function(data) { - $('').modal(); - }).success(function() { $('input:text:visible:first').focus(); }); + const url = $(this).attr('href'); + if (typeof url !== typeof undefined) { + if (url.indexOf('#') === 0) { + $(url).modal('open'); + } else { + $.get(url, function (data) { + $('').modal(); + }).success(function () { + $('input:text:visible:first').focus(); + }); + } } });