Reputation: 507
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.
Upvotes: 1
Views: 1668
Reputation: 5493
You want to set content of modal-content-create-ad in MJBOX so use html function.
MJBox.setContent($('#modal-content-create-ad').html());
Upvotes: 3