避免点击同一按钮显示多个boxy()框实例页面
代码:
JS代码:
$(function(){ $("#loginBtn").click(function(){ var that = $(this); if(! that.hasClass("only_once")){ that.addClass("only_once"); new Boxy("<form><p>用户名:<input id='loginUser' type='text' size='20' /></p><p class='mt20'><input type='button' value='确定' id='loginSure' /></p></form>", { title: "登录", afterHide: function(){ that.removeClass("only_once"); }}); } }); });
HTML代码:
<input type="button" value="登录 - 请多次点击我" id="loginBtn" />