10 examples of 'how to refresh modal dialog in jquery' in JavaScript

Every line of 'how to refresh modal dialog in jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
58function openModal(title, initContent, updateMethod){
59 $('#rrdmodal > .modal-header > h5').empty().append('<span>' + title + '</span><br>')
60 .append('<input class="range-button" type=button value="10.minutes" onclick="setRange(this.value);' + updateMethod + '">&nbsp;')
61 .append('<input class="range-button" type=button value="1.hour" onclick="setRange(this.value);' + updateMethod + '">&nbsp;')
62 .append('<input class="range-button" type=button value="6.hours" onclick="setRange(this.value);' + updateMethod + '">&nbsp;')
63 .append('<input class="range-button" type=button value="1.day" onclick="setRange(this.value);' + updateMethod + '">&nbsp;')
64 .append('<input class="range-button" type=button value="1.week" onclick="setRange(this.value);' + updateMethod + '">&nbsp;')
65 .append('<input class="range-button" type=button value="1.month" onclick="setRange(this.value);' + updateMethod + '">&nbsp;');
66
67 $('#rrdmodal > .modal-body')
68 .empty()
69 .append('<h1>' + initContent + '</h1>');
70
71 $('#rrdmodal').css('max-height', window.innerHeight - 90 + 'px').css('top', '350px');
72
73 $('#rrdmodal').modal({
74 keyboard: true,
75 backdrop: true,
76 show: true,
77 });
78}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

1function openModal(){
2 $('#modal').css({'top':(window.scrollY+50)+'px'});
3 $('#modal,#modal-overlay').fadeIn(300);
4};
7function setupModal(modalId, modalWidth, showImmediately) {
8 var modal = $("#" + modalId);
9 modal.before("<div id='" + modalId + "-placeholder' class='hide'></div>");
10 modal.modal({backdrop: "static", keyboard: false, show: false});
11 if (modalWidth)
12 modal.find(".modal-dialog").css({"width": modalWidth});
13 if (showImmediately)
14 showModal(modalId, undefined);
15}
41function _modal_show(){
42 $('#flot_modal').modal('show');
43}
1function initModal(id) {
2 $(id).click(function(event){
3 event.preventDefault();
4 $.ajax({ url:$(this).attr('href')+'?json=1', context: document.body, success: function(data, textStatus, XMLHttpRequest) {
5 data = eval('(' + data + ')');
6 $.modal(data.content, {
7 overlayClose:true,
8 opacity: 80,
9 minHeight:100,
10 minWidth: 200
11 });
12 $('#login_cancel').css('display', 'inline');
13 }});
14 return false;
15 });
16}
7function openModal(obj) {
8 var embedSrc = '<script type="text/javascript" src="' + obj.href + '"> </script>';
9
10 $('#embed').val(embedSrc);
11 $('#embedDescription').html("Embed code for 5 " + obj.getAttribute('collection') + ", in detailed format with default style rules applied:")
12 var pos = $(obj).offset();
13 var width = $(obj).width();
14
15 $("#modal").css( { "left": (pos.left - width) + "px", "top":pos.top + "px" } );
16
17 $('#modal').show("drop", { }, 150, function() {
18
19 });
20}
1function openEditModal(id) {
2 var link = '/admin/'+ id +'/get_user';
3 $("#editAcct").load(link);
4 $("#editAcct").modal('show');
5}
16function close_modal() {
17 $("#myModal_content").css("-webkit-animation", "umod 1s linear");
18 $("#myModal_content").css("animation-fill-mode", "forwards");
19 setTimeout(" $('#myModal').modal('hide')", 1000)
20}
4function openModal(ev) {
5 ajaxify.loadTemplate('modals/featured-topics-ex-sort', function(featuredTpl) {
6 socket.emit('admin.getFeaturedTopics', {tid: ajaxify.data.tid}, function(err, topics) {
7 if (err) return console.log(err);
8
9 bootbox.confirm(templates.parse(featuredTpl, {topics:topics}), function(confirm) {
10 var tids = [];
11 $('.featured-topic').each(function(i) {
12 tids.push(this.getAttribute('data-tid'));
13 });
14
15 socket.emit('admin.setFeaturedTopics', {tids: tids});
16 }).on("shown.bs.modal", function() {
17 $('span.timeago').timeago();
18 $('#sort-featured').sortable().disableSelection();
19
20 $('.delete-featured').on('click', function() {
21 $(this).parents('.panel').remove();
22 });
23 });
24 });
25 });
26}
82function ShowModalPopup(modalPopupID) {
83 var popupID = "#" + modalPopupID;
84 var popupMarginTop = $(popupID).height() / 2;
85 var popupMarginLeft = $(popupID).width() / 2;
86 $('body').css('overflow', 'hidden');
87 $(popupID).css({
88 'left': '50%',
89 'top': '50%',
90 'margin-top': -popupMarginTop,
91 'margin-left': -popupMarginLeft,
92 'display': 'block',
93 'position': 'fixed',
94 'z-index': 99999
95 });
96
97 var backgroundSelector = $('<div id="' + _ModalPopupBackgroundID + '" ></div>');
98 backgroundSelector.appendTo('body');
99
100 backgroundSelector.css({
101 'width': $(document).width(),
102 'height': $(document).height(),
103 'display': 'none',
104 'background-color': '#000',
105 'filter':'alpha(opacity=80)',
106 'position': 'absolute',
107 'top': 0,
108 'left': 0,
109 'z-index': 99998
110 });
111
112 backgroundSelector.fadeTo('fast', 0.8);
113 backgroundSelector.click(function(){
114 HideModalPopup(modalPopupID)
115 });
116
117}

Related snippets