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

Customizing SharePoint list and implementing Quick search using jQuery

Enable and Disable Client side People Picker using jQuery

Populate dropdown using jquery ajax in SharePoint