Okay, I've done some reading. According to someone that looked through the source, you need to use an <a> element to trigger the popup.
The suggestion is that you (a) make the triggering link hidden (b) attach an onclick handler as usual to your button (c) in the button's onclick function, call the onclick function of the triggering link.
Here's a trivial sample.
<!doctype html>
<html>
<head>
<script type="text/javascript" src="jquery-1.8.0.js"></script>
<script type="text/javascript" src="jquery.leanModal.min.js"></script>
<script>
$(function() {
$('a[rel*=leanModal]').leanModal({ top : 200, closeButton: ".modal_close" });
});
function mySampleFunc()
{
alert("Here we go!");
$("#basicPopup").click();
}
</script>
<style>
#test
{
width: 600px;
padding: 30px;
display: none;
background: white;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.7);
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
-moz-box-shadow: 0 0px 4px rgba(0,0,0,0.7);
}
</style>
</head>
<body>
<a id="basicPopup" rel="leanModal" name="test" href="#test">Basic Popup</a>
<button id="myBtn" onclick='mySampleFunc();'>Show alert then open dialog</button>
<div id="test">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum libero purus, convallis nec vestibulum eget, luctus vitae purus.
Vestibulum non mauris et sem vulputate pellentesque ac a turpis. Ut vel lacus vitae justo vestibulum lobortis.
Nunc ipsum ipsum, laoreet id dictum nec, fermentum vel purus. Maecenas nisl felis, faucibus non rutrum eu,
sollicitudin sed ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent dignissim
lacinia tempus. Nulla facilisi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla
facilisi. Nulla accumsan pellentesque velit, a malesuada diam tristique a. Fusce eleifend magna erat, et imperdiet orci. Quisque
sapien mauris, malesuada eu tristique pulvinar, placerat id ligula. Vivamus vitae viverra nulla. Donec eget turpis vel erat malesuada sodales.</p>
</div>
</body>
<html>