views:

44

answers:

1

I'm having issues trying to append dynamically created html inside a SimpleModal box (OSX style).

<div id="osx-modal-content">
    <div id="osx-modal-title">Foo Modal</div>
    <div class="close"><a href="#" class="simplemodal-close">x</a></div>
        <div id="osx-modal-data">
        <a class="dynamic">Click</a>
        <span class="for-dynamic-link"></span>
        <p><button class="simplemodal-close">Close</button> <span>(or press ESC or click the overlay)</span></p>
    </div>
</div>

After closing the modal box all dynamically inserted html disappears. Is there something in the plugin that i can tweak to fix this?

$("#osx-modal-data").find("a.dynamic").bind("click", function() {
    $("#osx-modal-data span.for-dynamic-link").append("<p>Foo Test</p>");
    return false;
});

My main problem is that i can't use AutoSuggest Jquery Plugin because everytime i close and re-open the modal box it shows a pretty bad buggy behavior.

+1  A: 

Try using the persist:true option. You can either modify the source or after SimpleModal is loaded and before the osx JS is run, add:

<script>
    $.modal.defaults.persist = true;
</script>

If that doesn't work, let me know.

Eric Martin
It works beautifully, thank you
fuSi0N