For this demo just open your browser, then open your SharePoint site, login with your credentials and open the developer console of the browser:
function showItemTab(){
ribbon = SP.Ribbon.PageManager.get_instance().get_ribbon();
SelectRibbonTab("Ribbon.ListItem",true);
}
function clearAll(){
var clvp = ctx.clvp;
var tab = clvp.tab;
DeselectAllItems(ctx,tab.rows,false);
}
function selectItems(){
clearAll();
for (var i=0; i<ctx.ListData.Row.length;i++){
if(parseInt(ctx.ListData.Row[i].ID) % 2 !==0){
SelectRowByIndex(ctx,i,true);
}
}
}
selectItems();
var itemCount = CountSelectedItems(ctx);
alert("There are " +itemCount+" selected items to be deleted. Please confirm and then click the Delete button in the Ribbon to delete them.");
showItemTab();
where:
// selectItems() : This is for select item in our list for checking from the UI
// itemCount : Get count the number of item selected
// showItemTab(): Show the Item tab in the ribbon so the delete button is available for US
// 2!==0 : if ID is odd then select the Row
// DeselectAllItems : OOB function deselect all the item on the UI
//var clvp = ctx.clvp; getting properties
//var tab = clvp.tab; getting properties
// showItemTab : show the list item tab in the ribbon
// SelectRibbonTab("Ribbon.ListItem",true) : OOB function, Ribbon.ListItem : For Item Tab
See this in Action in below images:



As you see the 4 items are selected now and the Ribbon is opened for delete the items.
Learn more! Explore more.....
Thank you