dialog only loading once
Permalink 1 user found helpful<div id="myDialogContent" style="display: none"> <button>Yes, sign me up</button> </div> <script type="text/javascript"> loadMyDialog = function() { jQuery.fn.dialog.open({ title: 'select this', element: '#myDialogContent', width: 300, modal: false, height: 80, }); } </script>
thanks
C
C
var el = document.createElement('div')
el.id = "myNewElement"
el.innerHTML = $('#myDialogContent').html();
el.style.display = "none"
$('#myDialogContent').parent().append(el);
jQuery.fn.dialog.open({
...
element:'#myNewElement',
...
})
C
$.fn.dialog.open({
title: $('#quick-edit_versionsMsg'+bID).val(),
href: url,
width: '700px',
modal: false,
height: '350px'
});
In my case I had a series of anchor links where I needed to pop up a dialog with the content based on an attribute of the link (an ID) and the content being pulled from a PHP tool script that makes use of the C5 functionality and is not an anonymous (external) PHP script.
The selector in my case was class="ad"
So I ended up with this code:
$(function() { $(".ad").click(function() { var adID = $(this).attr("aid"); $.post(CCM_TOOLS_PATH + '/ads/report', { adID: adID }, function(data){ var el = document.createElement('div'); el.id = "myDialogContent"; el.innerHTML = data; $('#content').append(el); $.fn.dialog.open({ title: 'Ad Campaign Performance', element: '#myDialogContent', width: 550, modal: false, height: 380, });
One way to get around this is to put your content in an external file and load that. This link explains that approach in more detail:http://www.concrete5.org/documentation/how-tos/javascript-jquery-an...