1

Quick question, I having problem loading a div in my jBox (A simple jquery popup script). This is the code I'm using

<script>
$(document).ready(function() {
    var MJBox = new jBox('Modal', {
        attach: $('#modalDragOnTitle'),
        width: 300,
        height: 450,
        title: 'Create new advertisement',
        overlay: true,
        draggable: 'title' });
    MJBox.setContent($('#modal-content-create-ad'));
});
</script>
<div id="modal-content-create-ad" style="display:none;">Hello this a div</div>

But if I put my text in setContent is works, code is like this:

<script>
$(document).ready(function() {
    var MJBox = new jBox('Modal', {
        attach: $('#modalDragOnTitle'),
        width: 300,
        height: 450,
        title: 'Create new advertisement',
        overlay: true,
        draggable: 'title' });
    MJBox.setContent('Hello this is a div');
});
</script>

Anybody how has an idea to get this to work? I want the content of the div to load in the js.

MBaas
  • 7,248
  • 6
  • 44
  • 61
Bart Scheffer
  • 497
  • 1
  • 3
  • 18

1 Answers1

3

You want to set content of modal-content-create-ad in MJBOX so use html function.

MJBox.setContent($('#modal-content-create-ad').html());
SSA
  • 5,433
  • 4
  • 36
  • 50