Modal pop ups in SharePoint

Modal pop ups in SharePoint

There may be requirement to implement modal pop ups in SharePoint, to use them we need to use below code :



<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $("#btnShowPopup").click(function(){
            ModalPopUp();
        });
    });

function ModalPopUp() {
     
    var options = {
        url: 'http://Server:Port/sites/Test/Lists/ListName/AllItems.aspx' ,
        title: 'Title',
        allowMaximize: false,
        showClose: true,
        width: 500,
        height: 350
    };
     
    SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
    return false;
}
</script>

<input type="button" id="btnShowPopup" value="Show Modal up"/>  

Comments

Popular posts from this blog

How to Customize exported excel's cell background color in Datatables

Clear DataTable on button click

Get more than 5000 list items in SharePoint using Deferred Promises jQuery