Show a Facebox from a button click event

2019-08-17 01:12发布

The examples I have seen all show a Facebox by clicking on an anchor. Is it possible to use a button instead? I am modifying an asp.net page that dynamically generates asp:button controls, and would like to not have to replace them with anchors. Thanks.

1条回答
做自己的国王
2楼-- · 2019-08-17 01:48

I was able to achieve this

jquery:

$('#save').click(function(){
    $.facebox($('#save_name').html());
});

html:

<input id='save' type='button' class="facebox" value='Save Report' />

<div id="save_name" style="display:none" >
    <label>Report Name: </label>
    <input name="report_name" type="text" />
    <input id="save_report" type="button" value="Save" />       

</div>
查看更多
登录 后发表回答