You have 2 options:
1) Put the close class (simplemodal-close) on an element in your modal data and SimpleModal will automatically bind the close function to the click event on that element.
Taking the example above, you'd want:
<div id="foo" style="display:none">
<p>Form HTML</p>
<span class="simplemodal-close">Close</span>
</div>
2) When you want to close the dialog programatically, call:
$.modal.close();
HTH!
-Eric (SimpleModal author)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…