Skip to content

Commit

Permalink
Merge pull request #32 from OpenBuildings/check-url-attr
Browse files Browse the repository at this point in the history
Fix JS error in console - check if href attribute is present
  • Loading branch information
bozhidargyurov authored May 19, 2020
2 parents 1977644 + c7c51f8 commit 662d693
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions web/js/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
$('<div class="modal hide fade">' + data + '</div>').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) {
$('<div class="modal hide fade">' + data + '</div>').modal();
}).success(function () {
$('input:text:visible:first').focus();
});
}
}
});

Expand Down

0 comments on commit 662d693

Please sign in to comment.